V5 Infinite loop issue
Alright so the old code is like
When I get data from useQuery, then onSuccess, I kinda assign data.data1 to data1 state, and data.data2 to data2 state, then I use those states to do other things. So far so good....
then upon upgrading to V5, I found this one is not working well as it will cause "too many re-render". That is I want to do the same when doing
How do I deal with such issues? Sometimes we can't just directly use the data we fetch from useQuery, as we might get different versions, and they have different structure, so I might need
When I get data from useQuery, then onSuccess, I kinda assign data.data1 to data1 state, and data.data2 to data2 state, then I use those states to do other things. So far so good....
then upon upgrading to V5, I found this one is not working well as it will cause "too many re-render". That is I want to do the same when doing
How do I deal with such issues? Sometimes we can't just directly use the data we fetch from useQuery, as we might get different versions, and they have different structure, so I might need
setData1 (data.oldVersion.data1) if it's an old version etc....