Next.js Discord

Discord Forum

Next13 layout (app dir) rendering child client component out of order?

Unanswered
Polar bear posted this in #help-forum
Open in Discord
Polar bearOP
I've got a simple layout. For some reason, on first render, the MainMenuWrapper appears AFTER {children} -- if I navigate on the client, the MainMenuWrapper pops back into place where it should be.

const RootLayout = ({
  children,
}: {
  children: React.ReactNode;
}) => {
  return (
    <div>
        <AnalyticsWrapper />
        <MainMenuWrapper />
        {children}
        <HelpCta />
    </div>
  );
}

export default RootLayout;


Worth mentioning that MainMenuWrapper loads the menu data and then renders a Client Component with the data retrieved server-side. That's the only "interesting" thing about that component versus it's sibling components.

0 Replies