Skip to content

Commit 453a3bd

Browse files
chengloualexkrolick
authored andcommitted
Swap order of increment and decrement in Counter examples (#2382)
I think UI-wise, decrement comes first.
1 parent 87685fd commit 453a3bd

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

content/docs/hooks-reference.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,8 +60,8 @@ function Counter({initialCount}) {
6060
<>
6161
Count: {count}
6262
<button onClick={() => setCount(initialCount)}>Reset</button>
63-
<button onClick={() => setCount(prevCount => prevCount + 1)}>+</button>
6463
<button onClick={() => setCount(prevCount => prevCount - 1)}>-</button>
64+
<button onClick={() => setCount(prevCount => prevCount + 1)}>+</button>
6565
</>
6666
);
6767
}
@@ -231,8 +231,8 @@ function Counter() {
231231
return (
232232
<>
233233
Count: {state.count}
234-
<button onClick={() => dispatch({type: 'increment'})}>+</button>
235234
<button onClick={() => dispatch({type: 'decrement'})}>-</button>
235+
<button onClick={() => dispatch({type: 'increment'})}>+</button>
236236
</>
237237
);
238238
}
@@ -290,8 +290,8 @@ function Counter({initialCount}) {
290290
onClick={() => dispatch({type: 'reset', payload: initialCount})}>
291291
Reset
292292
</button>
293-
<button onClick={() => dispatch({type: 'increment'})}>+</button>
294293
<button onClick={() => dispatch({type: 'decrement'})}>-</button>
294+
<button onClick={() => dispatch({type: 'increment'})}>+</button>
295295
</>
296296
);
297297
}

0 commit comments

Comments
 (0)