Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What exactly <React.StrictMode></React.StrictMode> component does?

I found this component inside a React practice, but i don't know what's the exact behavior.

e.g.

const App = () => {
  return (
    <React.StrictMode>
      <div id="cool-attribute">
        <h1>Welcome to the Jungle!</h1>
        <SearchParams />
      </div>
    </React.StrictMode>
  );
};

like image 362
oliverloops Avatar asked Oct 27 '25 05:10

oliverloops


1 Answers

First you need to understand is What actually a Strict Mode is.

Strict Mode is a mode in which compiler gets extra careful with some additional instructions, does not eliminate silent errors on its own instead throws them out and put more limitations while coding. For more information, please follow

React.StrictMode is a same thing but to provide more limitations while working specifically with React. Here is a comprehensive guide

If you are expecting something in UI, please stop because according to React.StrictMode documentation:

StrictMode does not render any visible UI. It activates additional checks and warnings for its descendants.

like image 177
Zain Ul Abideen Avatar answered Oct 28 '25 20:10

Zain Ul Abideen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!