What’s StrictMode in React?

In this article I want to talk about StrictMode component and why developers should use this component.

Marjan Ahmadi
2 min readDec 1, 2020
StrictMode component

“use strict” Definition:

The “use strict” defines that java script codes should be executed in strict mode and it can indicate the codes that have been written are following best practices.

For example if you declare a variable and don’t use this variable in your codes you will see warn in your console.

Just IE9 doesn’t support this mode, but don’t worry, your application will run completely and there isn’t any problem for your application.

<StrictMode /> Component in React:

React has a component named <StrictMode/>, It is sort of a helper component that will help you write better react components. This component doesn’t render any visible UI.

When you are using this component, your inside components will render twice, but don’t worry, It doesn’t impact on your performance. There isn’t any problem with this, because components will render twice just in “development mode”, not “production mode”. <StrictMode /> renders components twice in order to detect any problems with your code and warn you about them.

--

--