Replies: 1 comment 3 replies
-
counter question: why would you need to do that? To get the real itemIds, you can just map over the returned |
Beta Was this translation helpful? Give feedback.
3 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.
Uh oh!
There was an error while loading. Please reload this page.
-
We have a list of item ids. To display the list, we make an API call which gives us the list of item details. It may be the case that some of the original item ids are non-existing, so once we’ve received the query result, we might want to call
setState
and thus reduce the list of original items. This will triggeruseQuery
again, but let’s assume it's cheap.Here is my question: is it ‘legal’ to call
useState
right from the query body? Or should this be done inuseEffect
, thus ensuring that query function itself has no side-effects?Here is how this might if queries must be pure:
Beta Was this translation helpful? Give feedback.
All reactions