What is StrictMode in ReactJS?

StrictMode is a tool added in the version 16.3 of React to highlight potential problems in an application. It performs additional checks on the application. To enable StrictMode, React.StrictMode tags need to be added inside the application.
StrictMode currently helps with the following issues:

  • Identifying components with unsafe lifecycle methods
    Certain lifecycle methods are unsafe to use in asynchronous react applications. With the use of third-party libraries it becomes difficult to ensure that certain lifecycle methods are not used.
    StrictMode helps in providing us a warning if any of the class components uses an unsafe lifecycle method.
  • Warning about the usage of legacy string API
    If one is using an older version of React, callback ref is the recommended way to manage refs instead of using the string refs . StrictMode gives a warning if we are using string refs to manage refs.