Web / ReactJS Interview questions
What is Strict Mode in React?
StrictMode is a tool for highlighting potential problems in an application. Like Fragment, StrictMode does not render any visible UI. It activates additional checks and warnings for its descendants.
You may enable strict mode for any part of your application.
Strict mode checks are run in development mode only; they do not impact the production build.
import React from 'react'; function ExampleApplication() { return ( <div> <Header /> <React.StrictMode> <div> <ComponentOne /> <ComponentTwo /> </div> </React.StrictMode> <Footer /> </div> ); }
StrictMode currently helps with:
- 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.
More Related questions...