Browse Source

Swap order of increment and decrement in Counter examples (#2382)

I think UI-wise, decrement comes first.
main
Cheng Lou 5 years ago
committed by Alex Krolick
parent
commit
453a3bd4f2
  1. 6
      content/docs/hooks-reference.md

6
content/docs/hooks-reference.md

@ -60,8 +60,8 @@ function Counter({initialCount}) {
<> <>
Count: {count} Count: {count}
<button onClick={() => setCount(initialCount)}>Reset</button> <button onClick={() => setCount(initialCount)}>Reset</button>
<button onClick={() => setCount(prevCount => prevCount + 1)}>+</button>
<button onClick={() => setCount(prevCount => prevCount - 1)}>-</button> <button onClick={() => setCount(prevCount => prevCount - 1)}>-</button>
<button onClick={() => setCount(prevCount => prevCount + 1)}>+</button>
</> </>
); );
} }
@ -231,8 +231,8 @@ function Counter() {
return ( return (
<> <>
Count: {state.count} Count: {state.count}
<button onClick={() => dispatch({type: 'increment'})}>+</button>
<button onClick={() => dispatch({type: 'decrement'})}>-</button> <button onClick={() => dispatch({type: 'decrement'})}>-</button>
<button onClick={() => dispatch({type: 'increment'})}>+</button>
</> </>
); );
} }
@ -290,8 +290,8 @@ function Counter({initialCount}) {
onClick={() => dispatch({type: 'reset', payload: initialCount})}> onClick={() => dispatch({type: 'reset', payload: initialCount})}>
Reset Reset
</button> </button>
<button onClick={() => dispatch({type: 'increment'})}>+</button>
<button onClick={() => dispatch({type: 'decrement'})}>-</button> <button onClick={() => dispatch({type: 'decrement'})}>-</button>
<button onClick={() => dispatch({type: 'increment'})}>+</button>
</> </>
); );
} }

Loading…
Cancel
Save