redirect on client for 404

This commit is contained in:
Nathaniel Tampus
2023-03-06 17:25:15 +08:00
parent 7fea5f933e
commit b98e4a23a9

View File

@@ -1,12 +1,14 @@
export default function NotFound() {}
import { useRouter } from "next/router";
import { useEffect } from "react";
// Temporary. Move to app/ directory when it's supported
export function getStaticProps() {
return {
redirect: {
destination: "/",
permanent: true
}
};
export default function NotFound() {
const router = useRouter();
useEffect(() => {
router.replace("/");
});
return null;
}