diff --git a/src/content/7/en/part7b.md b/src/content/7/en/part7b.md index f1271d97875..7923e0e668a 100644 --- a/src/content/7/en/part7b.md +++ b/src/content/7/en/part7b.md @@ -42,6 +42,7 @@ We implemented a counter application in [part 1](/en/part1/component_state_event ```js import { useState } from 'react' + const App = () => { const [counter, setCounter] = useState(0) @@ -60,6 +61,8 @@ const App = () => { ) } + +export default App ``` Let's extract the counter logic into a custom hook. The code for the hook is as follows: diff --git a/src/content/7/fi/osa7b.md b/src/content/7/fi/osa7b.md index 5ad0f097ea1..87e80bb3126 100644 --- a/src/content/7/fi/osa7b.md +++ b/src/content/7/fi/osa7b.md @@ -47,6 +47,7 @@ Teimme [osassa 1](/osa1/komponentin_tila_ja_tapahtumankasittely#tapahtumankasitt ```js import { useState } from 'react' + const App = () => { const [counter, setCounter] = useState(0) @@ -65,6 +66,8 @@ const App = () => { ) } + +export default App ``` Eriytetään laskurilogiikka custom-hookiksi. Hookin koodi on seuraava: