# useReducer ```jsx= const ACTIONS = { INCREMENT:'inc', DECREMENT:'dec' } const reducer = (state, action) => { if(action.type === ACTIONS.INCREMENT){ return state + 1 }else if(action.type === ACTIONS.DECREMENT){ return state - 1 } return state; }; const [state , dispatch] = useReducer(reducer , inatialState = 0) ```
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up