Watch “Implement useState with useReducer” on egghead.io Here’s the TL;DR: const useStateReducer = (prevState, newState) => typeof newState === 'function' ? newState(prevState) : newState const useStateInitializer = initialValue => typeof initialValue === 'function' ? initialValue() : initialValue function useState(initialValue) { ...