Next.js Discord

Discord Forum

Does anyone know why NextJS dev mode recreates class instances?

Answered
Chinese Alligator posted this in #help-forum
Open in Discord
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 next.config.js to disable it.

See: https://nextjs.org/docs/app/api-reference/next-config-js/reactStrictMode
View full answer

3 Replies

Avatar
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 next.config.js to disable it.

See: https://nextjs.org/docs/app/api-reference/next-config-js/reactStrictMode
Answer
Avatar
Chinese Alligator
Thanks man appreciate it!
Avatar
Np ✌🏻