You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Lets assume that the data returned from this endpoint like:
{
"static_data": {
... static data here...
},
"dyamic_data_from_query_params": {
... dyanmic data here...
},
}
I have been trying to figure out a way to memoize / store in state the static data returned from this query (this static data will never change as the result of query parameters). The reason for doing this is I want to prevent rerendering of the components that use this data on one of my pages. I realize I could fix this all together by simply making two API queries but wanted to see if this is possible from a single API query.
So far I have tried both:
Memoizing the the static parts of the data I want to persist but as query parameters change and new data is loaded, the memoized data becomes undefined again.
I have also tried using select by setting additional state in my app but this causes infinite re-rendering.
Basically, I am asking is what I am trying to do even possible or should I just stick to two separate queries.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have a dynamic query (using search params) like:
Lets assume that the data returned from this endpoint like:
I have been trying to figure out a way to memoize / store in state the static data returned from this query (this static data will never change as the result of query parameters). The reason for doing this is I want to prevent rerendering of the components that use this data on one of my pages. I realize I could fix this all together by simply making two API queries but wanted to see if this is possible from a single API query.
So far I have tried both:
Basically, I am asking is what I am trying to do even possible or should I just stick to two separate queries.
Thank you
Beta Was this translation helpful? Give feedback.
All reactions