React.js Strict mode

Strict mode is a feature for focusing on the potential problems in the application. Unlike Fragment, Strict mode does not render any visible UI. It activates checks and warnings. 

import React from 'react';


function ExampleApplication() {

  return (

    <div>

      <Header />

      <React.StrictMode>        <div>

          <ComponentOne />

          <ComponentTwo />

        </div>

      </React.StrictMode>      <Footer />

    </div>

  );

}



The above example illustrates how to apply strict mode in any part of your application. Here strict mode is activated only in the div and not in header and footer components. The componentOne and componentTwo and their descendants will have the checks anyway. StrictMode will help to find components with unsafe lifecycles, it will warn about legacy string ref API usage and deprecated findDOMNode usage. It will detect unexpected side effects, legacy context API. 

Some lifecycle methods are If your application uses third party libraries it is difficult to find whether these life cycles are being used or not.