Skip to content
Discussion options

You must be logged in to vote

there is only one select, no chaining. I would just make a simple transformation like that in the custom hook:

const useMyQuery = () => {
  const query = useQuery(...)

  return {
    ...query,
    data: React.useMemo(() => ({
      currentData: query.data.rows,
      total: query.data.total,
      page: query.data.page
    }), [query.data])
  }
}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by buglessir
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants