StrictMode
Enables extra development checks for the wrapped component tree.
Syntax
<StrictMode>...</StrictMode> Returns
element — A wrapper that activates strict development-only behaviors.
Examples
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
createRoot(document.getElementById('root')).render(
<StrictMode>
<App />
</StrictMode>
);
Notes
In development, StrictMode double-invokes component, initializer, and effect
setup/cleanup functions to surface impure logic and missing cleanup, warns
about deprecated APIs, and adds no behavior or overhead in production. It
only affects the tree inside it and can wrap part of an app.