one
Version:
One is a new React Framework that makes Vite serve both native and web.
22 lines (21 loc) • 515 B
JavaScript
import { useRef } from "react";
import { useRouter } from "../hooks.mjs";
import { useFocusEffect } from "../useFocusEffect.mjs";
function Redirect({
href
}) {
const router = useRouter(),
hasRedirected = useRef(!1);
return useFocusEffect(() => {
if (!hasRedirected.current) {
hasRedirected.current = !0;
try {
router.replace(href);
} catch (error) {
console.error(error);
}
}
}, [href]), null;
}
export { Redirect };
//# sourceMappingURL=Redirect.mjs.map