From bb95ef4d87801ea26b9caad59c834cf36d75473b Mon Sep 17 00:00:00 2001 From: Gobbledyglomp Date: Sat, 15 Nov 2025 11:51:34 +0100 Subject: [PATCH] Include full code for the initial counter application The code that was provided for the counter application wasn't complete as it missed the export. So, to make it easier for those who follow the examples, add the complete code --- src/content/7/en/part7b.md | 3 +++ src/content/7/fi/osa7b.md | 3 +++ 2 files changed, 6 insertions(+) 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: