In React, A component will update whenever state is updated regardless of whether the next state is identical to the current state. So all we need to make it happen is call a
setState function. Doesn't even need a value.
const useForceUpdate = () => React.useState()
This can be useful when using
useRef. Changes to
refs won't trigger a component to update. Calling
forceUpdate after setting a
ref may be the trick you're looking for.
I write a newsletter to share my thoughts and the projects I'm working on. I would love for you to join the conversation. You can unsubscribe at any time.