Skip to content

fetch data ONE time for useQuery #3019

Answered by abuuzayr
IRediTOTO asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @IRediTOTO , you should be able to use the staleTime option to disable refetching:

const [data] = useQuery(
    getUserProfile,
    { id: 1 },
    { staleTime: Infinity }  // The data will never be considered stale, i.e. no refetching is done
  )

The rest of the options are here: https://blitzjs.com/docs/use-query

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by IRediTOTO
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