react.strictmode provider code example
Example 1: 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.
*/
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')