When the user clicks submit, React Router calls an API, and then in the component function, useActionData
hook is called to process the results of the API call and update the state.
A bug takes place in strict mode because the entire component function is called again and, as expected, the state resets to defaults in the second function call and the API result is overridden.
So the root cause is that the React Router action is called only once despite using strict mode. How to fix this?