Should you leave Strict Mode enabled in your app permanently, or only use it temporarily?
Short answer
Strict Mode is generally recommended to stay enabled throughout an entire project's development, since it continues to help catch new problems as the codebase grows and changes over time.
Advertisement
AModel answer
Strict Mode is generally recommended to stay enabled throughout an entire project's development, since it continues to help catch new problems as the codebase grows and changes over time. It has no effect at all on the production build, so there is no downside to leaving it on during development.
// A typical setup, Strict Mode wraps the whole app and stays enabled long term
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
createRoot(document.getElementById('root')).render(
<StrictMode>
<App />
</StrictMode>
);Real-world example
A team keeps Strict Mode enabled across their entire project's lifetime, catching several small bugs introduced by new features over time before they ever reached real users in production.
Likely follow-ups
- Are there any legitimate reasons a team might choose to disable Strict Mode for part of their app?
- How would you gradually introduce Strict Mode into a large existing codebase that was not using it before?
Related topics