Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Dispatch using hooks
export default function SomeCount () {
const [state, dispatch] = useStore();
return (
Count: {state.count}
<button onClick={() => dispatch(addOne())}>
+ 1
<button onClick={() => dispatch(addN(5))}>
+ 5
<button onClick={() => dispatch(addN(10))}>
+ 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.