InterviewHubPRO
Section Overview
Q242

Question 242 of 445

Part 8: Advanced React Patterns, Portals & Performance (152 - 261)

54%
React & Modern Frontend (445 Qs)•Part 8: Advanced React Patterns, Portals & Performance (152 - 261)

What is strict mode in React?

React.StrictMode is a useful component for highlighting potential problems in an application. Just like <Fragment>, <StrictMode> does not render any extra DOM elements. It activates additional checks and warnings for its descendants. These checks apply for development mode only.

jsx
import { StrictMode } from "react";

function App() {
return (
  <div>
    <Header />
    <StrictMode>
      <div>
        <ComponentOne />
        <ComponentTwo />
      </div>
    </StrictMode>
    <Header />
  </div>
);
}

In the example above, the strict mode checks apply to <ComponentOne> and <ComponentTwo> components only. i.e., Part of the application only.

Note: Frameworks such as NextJS has this flag enabled by default.