Does anyone know why NextJS dev mode recreates class instances?
Answered
Chinese Alligator posted this in #help-forum
Original message was deleted.
Answered by not-milo.tsx
That's a little something React does when it's in strict mode. It renders all components twice to detect any potential issues with them and warn you. It's recommended that you keep it, but if you don't want to you can use
See: https://nextjs.org/docs/app/api-reference/next-config-js/reactStrictMode
next.config.js
to disable it.See: https://nextjs.org/docs/app/api-reference/next-config-js/reactStrictMode
3 Replies
![Avatar](https://cdn.discordapp.com/avatars/548149742207631360/2b1e750ac12613e7f54964225371f39b.webp?size=256)
not-milo.tsx
That's a little something React does when it's in strict mode. It renders all components twice to detect any potential issues with them and warn you. It's recommended that you keep it, but if you don't want to you can use
See: https://nextjs.org/docs/app/api-reference/next-config-js/reactStrictMode
next.config.js
to disable it.See: https://nextjs.org/docs/app/api-reference/next-config-js/reactStrictMode
Answer
![Avatar](https://cdn.discordapp.com/embed/avatars/5.png)
Chinese Alligator
Thanks man appreciate it!
![Avatar](https://cdn.discordapp.com/avatars/548149742207631360/2b1e750ac12613e7f54964225371f39b.webp?size=256)
not-milo.tsx
Np ✌ðŸ»