redux toolkit - dispatch() inside useEffect passing null value as payload #3503
joshtheflame
started this conversation in
General
Replies: 1 comment 5 replies
-
Sorry, I'm on mobile, so pretty short: Just dispatch the action(payload), not action(state, payload). Also, generally you would not do data fetching inside your component using Redux - please take a look at our "Essentials" tutorial on the Redux homepage 🙂 |
Beta Was this translation helpful? Give feedback.
5 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I built a small application "Task Manager" using Context API and now while learning redux toolkit I am currently transforming this application from ContextAPI to redux toolkit. I am also using "React-Query" to fetch data from the backend where all my tasks are stored and storing in an array "mydata" which I am passing to dispatch along with current state to update the state but getting null value of that array I am passing. what am I doing wrong? appreciate if someone can help me.
Store.js
Tasks.js
Beta Was this translation helpful? Give feedback.
All reactions