When would you use StrictMode component in React? 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: can you wrap redux provider within react.strictmode

// React.StrictMode should wrap the whole application including the provider too. So Change your code like bellow:  
  <React.StrictMode>
    <Provider store={store}>
      <App />
    </Provider>
  </React.StrictMode>,
  document.getElementById('root')

Tags:

Html Example