- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Strict Mode in ReactJS
In this article, we are going to see how to highlight potential problems that we might have in a React Application.
React.StrictMode is a helper functionality provided by React which allows us to write better React codes. It provides visual feedback in the form of warnings if we don’t follow the React guidelines, but it works only in the development mode.
Note: They are unsafe to use while using async await.
Use-cases of Strict Mode −
Identifying components with unsafe lifecycles
Warning about legacy string ref API usage
Warning about deprecated findDOMNode usage
Detecting unexpected side effects
Detecting legacy context API
We can also bind React.StrictMode to work only for certain components only. For example,
<Comp1/> <React.StrictMode> <Comp3/> </React.StrictMode> <Comp2/>
Here, strict mode is only enabled for Comp3 Component only.
If we use deprecated class components of React like componentWillReceiveProps, then it will show the following warning.
- LocalStorage in ReactJS
- RegEx in ReactJS
- Suspense in ReactJS
- Supervisor Mode (Privileged Mode)
- User Mode vs Kernel Mode
- Lazy Loading in ReactJS
- Validate URL in ReactJS
- Conditional Rendering in ReactJS
- Context API in ReactJS
- CSS Loader in ReactJS