DEV Community

Calie Rushton
Calie Rushton

Posted on

Things I learned last week (20/24)

  1. By default, all React components in NextJS are React Server Components, whereas in vanilla React, all the components are client components.

  2. You can prove that a function (component) is being executed on the server by adding a console log, then checking in the terminal where NextJS is running. The log will not appear in the browser dev tools.

  3. In NextJs the notFound() function will load the nearest not-found page to the component where it is invoked. To show a more specific message, create a not-found page next to that component.

  4. It's a good idea to export types and interfaces from React components, so that the tests you write will be able to access them.

Top comments (0)

Eliminate Context Switching and Maximize Productivity

Pieces.app

Pieces Copilot is your personalized workflow assistant, working alongside your favorite apps. Ask questions about entire repositories, generate contextualized code, save and reuse useful snippets, and streamline your development process.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay