Link
Unanswered
Asian black bear posted this in #help-forum
Asian black bearOP
Morning!! how can I use the getServerSideProps with next.js14.. knowing that we can't put in inside of app/ .. I need return a 404 page if the user try get a invalid route page.. Ex: http:localhost.com:3000/dashboard/${
here a dinamic route}/details-of-project4 Replies
Asian paper wasp
Assuming you are using App Router:
Instead, the App Router has a
e.g.
how can I use the getServerSidePropsNo, that's Page Router's API.
Instead, the App Router has a
notFound() API that "redirects" to the not-found.tsx page when called.e.g.
// /app/dashboard/[projectId]/details-of-project/page.tsx
export default async function Page({ params }: { params: { projectId: string } }) {
const validProjectIds = await getcProjectIdsFromDb();
if(!validProjectIds.includes(params.projectId)) notFound();
}Asian black bearOP
Thanks my friend! 😄