React Router work on reload, but not when clicking on a link

I would go through your components and make sure you have only one <Router> … </Router>. Also — make sure you have a <Router>…</Router> There may be cases when you’d use more than one, but if you accidentally have nested routers (because you were hacking quickly and forgot to remove one when you were moving … Read more

How do I see state when logging to the console instead of Proxy object inside reducer action?

Solution You need to use the current function in order to see the actual value of the state. In your reducer, you can call: console.log(current(state)); This current function comes from the Immer package which is a dependency of Redux Toolkit. It is re-exported by Redux Toolkit, so it can be imported from either package: import … Read more

My Redux state has changed, why doesn’t React trigger a re-render?

You’ve got everything hooked up correctly, but you’re missing one key concept for Redux: With Redux, you never mutate any part of state. From the Redux guide: Things you should never do inside a reducer: Mutate its arguments; Perform side effects like API calls and routing transitions; Call non-pure functions, e.g. Date.now() or Math.random(). In … Read more

Could not find “store” in either the context or props of “Connect(App)”

Provider, passes the store to the component nested within it and generally only needed to be applied to the root component (in your case <RootContainer> connect connect with the component providing store and not the component that has store provided to it. SUGGESTED SOLUTION: MOVE the connect to the <RootContainer> component file instead, and pass … Read more

how to async/await redux-thunk actions?

The Promise approach export default function createUser(params) { const request = axios.post(‘http://www…’, params); return (dispatch) => { function onSuccess(success) { dispatch({ type: CREATE_USER, payload: success }); return success; } function onError(error) { dispatch({ type: ERROR_GENERATED, error }); return error; } request.then(success => onSuccess, error => onError); }; } The async/await approach export default function createUser(params) … Read more