Replies: 1 comment
-
It seems that you didn't call the inner fetcher functions. This should work: return (
<SWRConfig value={{ fetcher: (key) => (key.includes('test') ? fetcherTest(key) : fetcherNormal(key)) }}>
<Component />;
</SWRConfig>
); |
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 want to use fetcher function by using SWRConfig, except for specific key value.
For Instance, if the key containing 'local' key use
fetcher1
function, and others usefetcher2
function.But with that code, when using mutate, the value initially changes to the expected value, but then immediately to an undefined value.
I guess that reason is refetching function in SWRConfig.. (cuz if I remove that code, it works well)
I already know multiple use
<SWRConfig />
. but, I want to divide by key value.. not by componentThis is my code.
and use mutate in component, it's not working.
How can I fix this problem?
Beta Was this translation helpful? Give feedback.
All reactions