How can I force a component to re-render with hooks in React?
This is possible with useState or useReducer, since useState uses useReducer internally: const [, updateState] = React.useState(); const forceUpdate = React.useCallback(() => updateState({}), []); forceUpdate isn’t intended to be used under normal circumstances, only in testing or other outstanding cases. This situation may be addressed in a more conventional way. setCount is an example of … Read more