one
Version:
One is a new React Framework that makes Vite serve both native and web.
21 lines (20 loc) • 502 B
JavaScript
import { useRef } from "react";
import { useRouter } from "../hooks";
import { useFocusEffect } from "../useFocusEffect";
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.js.map