skip to Main Content

I have React.StrictMode set to true next.config.mjs of Next.js I am using for React project. Do I still wrap with <React.StrictMode> in the layout.tsx ?
Do both serve the same purpose?
I have page.tsx and layout.tsx in the Next.js project.

2

Answers


  1. It depends on your purpose, in case you need to set strict mode to the entire application you can use the next.config.mjs file.

    or you need to specifically set the component to strict mode you can wrap the the component alone with <React.StrictMode>.

    Login or Signup to reply.
  2. No you don’t need because it is enabled by default since Next.js 13-4

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search