Skip to content

how to avoid React query calling the same api multiple times on initial render. #6542

Answered by aboveyunhai
aboveyunhai asked this question in Q&A
Discussion options

You must be logged in to vote

It seems like based on this one: #3630
https://stackoverflow.com/questions/72828361/what-are-staletime-and-cachetime-in-react-query
The staleTime will do the trick, but I'm not sure if there is any potential tradeoff or bug it might lead to if I set it to something like 1000ms.

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
2 replies
@alxvallejo
Comment options

@aboveyunhai
Comment options

Answer selected by aboveyunhai
Comment options

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

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants