Map queries in a single hook
I have a query from Tanstack-Query that returns an object with inside it an array of variable length (it can be an empty array). Inside this array, there are objects with one URL inside each object.
I want to fetch data for each URL inside one
Currently, I have this
What do you think I should change to make the query works ?
I want to fetch data for each URL inside one
useQuery or useQueries hook.Currently, I have this
useQueries hook which returns an error that queries is undefined:
I need to keep the enabled field because locationQuery results from a query in the same file.What do you think I should change to make the query works ?
1 Reply
deep-jade•3y ago
Queries is undefined if data is undefined. Nullish Coescaling helps