Skip to content

Commit b5fa1df

Browse files
itadityagaearon
authored andcommitted
Reset button should set the state back to initialCount (reactjs#1327)
1 parent 92d96a3 commit b5fa1df

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

content/docs/hooks-reference.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function Counter({initialCount}) {
5454
return (
5555
<>
5656
Count: {count}
57-
<button onClick={() => setCount(0)}>Reset</button>
57+
<button onClick={() => setCount(initialCount)}>Reset</button>
5858
<button onClick={() => setCount(prevCount => prevCount + 1)}>+</button>
5959
<button onClick={() => setCount(prevCount => prevCount - 1)}>-</button>
6060
</>

0 commit comments

Comments
 (0)