Linked Questions

Popular Questions

In the following code for example, how can I update react-query to wait for the previous call to be complete before starting the next one?

I'm trying to hit an API that has rate limiting to one call at a time but I have a list of calls I need to make, I get a 429 if more than one are done at the same time.

const [selection, setSelection] = React.useState([])

const results = useQueries(
  selection.map(item => ({
    queryKey: ['something', item]
    queryFn: () => fetchItem(item)
   })
)

const data = results.map(result => result.data)

Related Questions