Is it possible to skip prerender /default/404 on 404.tsx
Unanswered
Reddish carpenter ant posted this in #help-forum
Reddish carpenter antOP
I am struggling with default language in i18next
3 Replies
Spectacled bear
create:
_errror.tsx in pages/
_errror.tsx in pages/
import { FC } from "react";
import serveProps from "@lib/serveProps";
interface ErrorProps {
statusCode: number;
main: any;
}
const Error: FC<ErrorProps> = ({ statusCode }) => {
return (
<p>
{statusCode
? `An error ${statusCode} occurred on server`
: "An error occurred on client"}
</p>
);
};
export const getServerSideProps = async (context: any) => {
const statusCode = context.res
? context.res.statusCode
: context.err
? context.err.statusCode
: 404;
const main = await serveProps(context);
return {
props: {
statusCode,
main,
app: {
theme: "light",
},
},
};
};
export default Error;then you can use getServerSideProps but it will not be static generated.
no you can get language from cookie or JWT token or whatever and pass it to whatever you need.