preface
When creating a project with create-react-app, < react. StrictMode> is wrapped in the outermost layer of the component in the index.js file. It is not the same as use strict in JS.
Break down
acts like a Fragment, only as a container, and does not render any real UI. It triggers additional checks and reports for its descendants. We can use this tag to turn on strict mode anywhere, such as in components and app.js (entry files). When checking is enabled, descendant elements are checked.
Functions and Advantages
- Identify unsafe lifecycle components
- Warning about the use of the old string ref
- Warning about deprecated methods such as (findDOMNode)
- Detect unexpected side effects
- Detect obsolete apis
Go to JS’s strict mode use strict