feat: add machine data

This commit is contained in:
Aarnav Tale
2024-03-25 18:47:15 -04:00
parent b38eb0885f
commit abaf71636e
10 changed files with 246 additions and 32 deletions
+16
View File
@@ -0,0 +1,16 @@
import { useRevalidator } from '@remix-run/react'
import { useInterval } from 'usehooks-ts'
type Properties = {
interval: number;
}
export function useLiveData({ interval }: Properties) {
const revalidator = useRevalidator()
useInterval(() => {
if (revalidator.state === 'idle') {
revalidator.revalidate()
}
}, interval)
}