react usereducer state code example Example: usereducer react const [state, dispatch] = useReducer(reducer, initialArg, init);