Hey there team, I am looking at this library at a high level so forgive me if the answer is obvious.
I am currently a project I work on uses redux actions to make calls to the api
Somthing like this: https://redux.js.org/advanced/async-actions/#async-action-creators
Is it possible with swr in its current form to use that action in the component to do the api call through swr?
You could make your fetcher (the second arg of useSWR) dispatch that action, but then you will need to wait for the data to be fetched and return it, not that every time SWR will revalidate the data it will dispatch the action again.
yeah the "auto-refresh" is a desirable outcome in some places, I see there is polling as well as re-validate strategies thanks!
Most helpful comment
You could make your fetcher (the second arg of useSWR) dispatch that action, but then you will need to wait for the data to be fetched and return it, not that every time SWR will revalidate the data it will dispatch the action again.