SWR does not run after component initialization with useEffect([]) #1219
Unanswered
eugeneborodkin
asked this question in
Q&A
Replies: 1 comment
-
You can call
I believe you can find this in the docs (swr.vercel.app). |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a functional component and an SWR fetch wrapped in a hook as follows,
This hook is used in a functional component which is initialized with useEffect(.., []) which is the standard React way of component mounting. I am noticing that SWR fetches before this useEffect[] initialization, and does not fetch or re-fetch after it:
So is useEffect([]) insufficient for SWR to re-validate? When exactly does SWR decide when to validate, given the above definition? What should I do to make it aware of useEffect[] re-fetching?
Beta Was this translation helpful? Give feedback.
All reactions