Run query only once #5021
Answered
by
TkDodo
stephen-liu-fipo
asked this question in
Q&A
Run query only once
#5021
-
Once I get the data from the server and render the ui. I don't need more queries. Normally, I will do this in a useEffect hook. Using React Query, is this the only way? const { data } = useQuery({
queryFn: async () => await graphQLClient.request(getData),
queryKey: ['getData'],
//
staleTime: Infinity
}) |
Beta Was this translation helpful? Give feedback.
Answered by
TkDodo
Feb 22, 2023
Replies: 1 comment
-
sure |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
stephen-liu-fipo
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sure