Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 143d871

Browse files
Using step prop in useDebugValue examples (#137)
The `setCount` in this examples are adding `+ 1' and not using the `step` prop that are receiving.
1 parent 864b783 commit 143d871

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

‎src/exercise/06.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ call it like so:
1818
function useCount({initialCount = 0, step = 1} = {}) {
1919
React.useDebugValue({initialCount, step})
2020
const [count, setCount] = React.useState(0)
21-
const increment = () => setCount(c => c + 1)
21+
const increment = () => setCount(c => c + step)
2222
return [count, increment]
2323
}
2424
```
@@ -69,7 +69,7 @@ const formatCountDebugValue = ({initialCount, step}) =>
6969
function useCount({initialCount = 0, step = 1} = {}) {
7070
React.useDebugValue({initialCount, step}, formatCountDebugValue)
7171
const [count, setCount] = React.useState(0)
72-
const increment = () => setCount(c => c + 1)
72+
const increment = () => setCount(c => c + step)
7373
return [count, increment]
7474
}
7575
```

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /