UNPKG

one

Version:

One is a new React Framework that makes Vite serve both native and web.

22 lines (21 loc) 513 B
import { useRef } from "react"; import { useRouter } from "../hooks.mjs"; import { useFocusEffect } from "../useFocusEffect.mjs"; function Redirect({ href }) { const router = useRouter(); const hasRedirected = useRef(false); useFocusEffect(() => { if (hasRedirected.current) return; hasRedirected.current = true; try { router.replace(href); } catch (error) { console.error(error); } }, [href]); return null; } export { Redirect }; //# sourceMappingURL=Redirect.mjs.map