Skip to content
Discussion options

You must be logged in to vote

this can be done with select:

const usePrices: (select) => {
  return useQuery({
    queryKey: ['prices'],
    queryFn: () => fetch('/api/prices'),
    select,
  })
}
const usePrice: (name) => {
  return usePrices(data => data[name] ?? 0 )
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jamesarosen
Comment options

Answer selected by jamesarosen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants