Replies: 3 comments 3 replies
-
This almost always is an accidental mutation bug. Can you show the related reducer? (as a side note, just reading that selector it looks like you're writing your code in a very verbose way that is unnecessary and not what we recommend. We specifically recommend not using the word "reducer" in your state slice names, and the |
Beta Was this translation helpful? Give feedback.
-
@markerikson I am not using the latest createSlices pattern yet. I am still using the Frankly speaking based on the tutorial I saw, the latest I was able to fix my issue by spreading out the state object after each update like this
|
Beta Was this translation helpful? Give feedback.
-
I see. Thank you so much. I'll make the changes right away. |
Beta Was this translation helpful? Give feedback.
-
What version of React, ReactDOM/React Native, Redux, and React Redux are you using?
What is the current behavior?
useSelector is no longer firing when actions are dispatched via useDispatch
const currentPageIndex = useSelector((state) => state.pageReducer[Constants.ReduxActions.CURRENT_PAGE] ?? defaultPage);
//CurrentPageIndex always returns 0 which is the default page even though dispatch has fired an action to change that.
What is the expected behavior?
I expect that when dispatch is called useSelector should pick up the latest changes.
Please note that this was all working perfectly until recently when I noticed that the useSelector hook is no longer firing.
Which browser and OS are affected by this issue?
All browsers
Did this work in previous versions of React Redux?
Beta Was this translation helpful? Give feedback.
All reactions