Relative Content

Tag Archive for reactjsreduxredux-toolkit

Issue with state in REDUX Toolkit – state always one step behind

So i’ve written the logic for a login functionality using RTK toolkit and these are the components. In the logic component, while calling on handle submit, i always get error to be empty the first time and then the second time it gets called, i get the actual state.

I constantly get the initial value from the reducer

I just started learning redux< redux-toolkit and ran into the problem that my stat from the “Pastime” reducer always returns the initial value, although it works correctly in another functional component.

Can always get the latest state value in async thunk?

Dispatch a normal action and a thunk serially. The goal is, when the fetchSomething() thunk is dispatched, I need to get the latest state value in the async thunk function by thunkAPI.getState(). The latest state value is {count: 1};