mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-23 20:23:08 +00:00
Swap order of increment and decrement in Counter examples (#2382)
I think UI-wise, decrement comes first.
This commit is contained in:
@@ -60,8 +60,8 @@ function Counter({initialCount}) {
|
||||
<>
|
||||
Count: {count}
|
||||
<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>
|
||||
</>
|
||||
);
|
||||
}
|
||||
@@ -231,8 +231,8 @@ function Counter() {
|
||||
return (
|
||||
<>
|
||||
Count: {state.count}
|
||||
<button onClick={() => dispatch({type: 'increment'})}>+</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})}>
|
||||
Reset
|
||||
</button>
|
||||
<button onClick={() => dispatch({type: 'increment'})}>+</button>
|
||||
<button onClick={() => dispatch({type: 'decrement'})}>-</button>
|
||||
<button onClick={() => dispatch({type: 'increment'})}>+</button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user