Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/content/7/en/part7b.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -60,6 +61,8 @@ const App = () => {
</div>
)
}

export default App
```

Let's extract the counter logic into a custom hook. The code for the hook is as follows:
Expand Down
3 changes: 3 additions & 0 deletions src/content/7/fi/osa7b.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -65,6 +66,8 @@ const App = () => {
</div>
)
}

export default App
```

Eriytetään laskurilogiikka custom-hookiksi. Hookin koodi on seuraava:
Expand Down