vercel / next-learn

Learn Next.js Starter Code
https://next-learn-dashboard.vercel.sh/
MIT License
3.75k stars 1.92k forks source link

Nesting not called in "Nesting components" code snippet #851

Open thetillhoff opened 2 months ago

thetillhoff commented 2 months ago

On section for Nesting components, there's the following code snippet:

function Header() {
  return <h1>Develop. Preview. Ship.</h1>;
}

function HomePage() {
  return (
    <div>
      {/* Nesting the Header component */}
      <Header />
    </div>
  );
}

const root = ReactDOM.createRoot(app);
root.render(<Header />);

As it is, the components are nested, but the wrong one is then rendered. It should be root.render(<HomePage />); instead.

thetillhoff commented 2 months ago

... Just read on with the next chapter, which then tackles that part. But, I think it would make sense to add a Sentence at the end along the lines "How to use that new component is described next."