You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Can anyone explain how this works, I found my error but I don't really understand how it all works, I wanted to pass the current date to the useQuery as a variable.
Bad version that was causing for the query to ininitely loop
I just encountered this too. Seems like variables are evaluated every render which is unexpected since this is a hook without a dependency array. So each render your date slightly changes and another request is made.
I solved this by getting the current time once when the component is created:
Can anyone explain how this works, I found my error but I don't really understand how it all works, I wanted to pass the current date to the useQuery as a variable.
Bad version that was causing for the query to ininitely loop
Fixed: Without
new
keywordCan someone explain in simple terms (or complex if you can't otherwise) why this happens?
The text was updated successfully, but these errors were encountered: