how to update query data without useEffect
Hi I'm using Redux and React-Query
and i want update response data when api call succeed
when i use onSuccess call back it's work but i read onSuccess is not good so i try
and stuck in an endless loop
i don't wan't use useEffect so what should i do?
shuld i use query-key? or cache?
4 Replies
like-gold•3y ago
which problem are you trying to solve? It shouldn't be necessary to put data into redux when you get a successful api response
eager-peachOP•3y ago
when i get a successful api response i want to process data and store it in redux
Is this the wrong approach?
like-gold•3y ago
yes
I've written about this a lot:
- https://tkdodo.eu/blog/practical-react-query
- https://tkdodo.eu/blog/react-query-as-a-state-manager
- https://tkdodo.eu/blog/thinking-in-react-query
eager-peachOP•3y ago
ok i'll read it again thanks!