react strictmode nextjs code example

Example 1: react strict mode

import React from 'react';

function ExampleApplication() {
  return (
    <div>
      <Header />
      <React.StrictMode>        <div>
          <ComponentOne />
          <ComponentTwo />
        </div>
      </React.StrictMode>      <Footer />
    </div>
  );
}

Example 2: react.strictmode

// https://reactjs.org/docs/strict-mode.html

import React from 'react';

function ExampleApplication() {
  return (
    <div>
      <Header />
      <React.StrictMode>
        <div>
          <ComponentOne />
          <ComponentTwo />
        </div>
      </React.StrictMode>
      <Footer />
    </div>
  );
}

/*
  In the above example, strict mode checks will not be run 
  against the Header and Footer components. 
  However, ComponentOne and ComponentTwo, as well as all of their
  descendants, will have the checks.
*/