What is the recommended way to poll data from a loader? #998
-
I need to poll my loader for some real-time data and I'm not sure what the recommended way to do this is. I'm currently doing this: const submit = useSubmit();
useEffect(() => {
const timer = setTimeout(() => {
submit(null, { method: 'get', replace: true });
}, 1000);
return () => clearTimeout(timer);
}); Works great although I am getting this warning in the console every time it polls: |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Check https://sergiodxa.com/articles/automatic-revalidation-in-remix where I explain how to do it. |
Beta Was this translation helpful? Give feedback.
-
I believe the current best practice to do this now is with |
Beta Was this translation helpful? Give feedback.
I believe the current best practice to do this now is with
useRevalidator
natively in remix:https://remix.run/docs/en/main/hooks/use-revalidator