Next.js Discord

Discord Forum

Next.js 14 Learn Course dashboard error!

Unanswered
Red-billed Tropicbird posted this in #help-forum
Open in Discord
Avatar
Red-billed TropicbirdOP
Hi,
I must be doing something wrong, but the dashboard page is constantly reloading and giving errors in the terminal. Its this part: https://nextjs.org/learn/dashboard-app/creating-layouts-and-pages#creating-the-dashboard-page

They said I should create a dashboard folder. Then, create a new page.tsx file inside the dashboard folder with the following content:
export default function Page() {
  return <p>Dashboard Page</p>;
}

Later I also had to create a layout.tsx file:
import SideNav from '@/app/ui/dashboard/sidenav';
 
export default function Layout({ children }: { children: React.ReactNode }) {
  return (
    <div className="flex h-screen flex-col md:flex-row md:overflow-hidden">
      <div className="w-full flex-none md:w-64">
        <SideNav />
      </div>
      <div className="flex-grow p-6 md:overflow-y-auto md:p-12">{children}</div>
    </div>
  );
}


The error is:
 ⨯ Error: The default export is not a React Component in page: "/dashboard"
    at async Promise.all (index 0)
 ⨯ Error: The default export is not a React Component in page: "/dashboard"
    at async Promise.all (index 0)
 ⨯ Error: The default export is not a React Component in page: "/dashboard"
    at async Promise.all (index 0)
digest: "3449662263"
 ⨯ Error: The default export is not a React Component in page: "/dashboard"
    at async Promise.all (index 0)


And the website itself constantly refreshes. I uploaded the error message photo as well as the folder structure.

Perhaps the error comes from me using turbopack in the dev?
Image
Image

4 Replies

Avatar
Red-billed TropicbirdOP
Hm, it seems to work after I stopped the server running and starting it again
e.g npm run dev again
Why is that?
Turbopack, or we just need to restart the dev terminal running totally sometimes?