That useState hook doesn't work the way you think it does. It's going to reset state every time the hook is invoked on rerender. It also isn't triggering a render, which is the entire point of the hook.