Next.js Discord

Discord Forum

The default export is not a React Component in page: "/dashboard"

Answered
Dimax posted this in #help-forum
Open in Discord
Everything was working fine and then out of nowhere I'm getting this weird error. I literally didn't change anything and now it's showing this for the dashboard and all of the other pages as well (shows a different page if I delete /dashboard)
import React, { FC } from 'react' import { createServerComponentClient } from '@supabase/auth-helpers-nextjs'; import { cookies } from 'next/headers'; import { redirect } from 'next/navigation'; type Props = {} const DashboardPage: FC = () => { return( <div className="bg-white px-6 py-24 sm:py-32 lg:px-8 h-screen lg:pl-72"> <div className="mx-auto max-w-2xl text-center"> <h2 className="mt-2 text-4xl font-bold tracking-lighy md:text-6xl text-yellow-950">Dashboard</h2> </div> </div> ) } export default DashboardPage
Answered by Dimax
After a long time I realized that the issue was the layout. Somehow It didnt have the export default and that was causing the issue 😅
View full answer

4 Replies

Try deleting .next folder and restart dev server?
@fuma nama Try deleting `.next` folder and restart dev server?
Still giving out the error 😦
I tried cloning the repo in another directory and it also gives the same error. Thinking of starting a new project from 0 at this point
Guess you can use function rather than const, I didn’t tried arrow functions for pages in App Router, but it should be working though
After a long time I realized that the issue was the layout. Somehow It didnt have the export default and that was causing the issue 😅
Answer