1. 30
    Avoid Deprecated React APIs with React.StrictMode
    3m 3s

Avoid Deprecated React APIs with React.StrictMode

Andy Van Slaars
InstructorAndy Van Slaars

Share this video with your friends

Send Tweet

React has deprecated some APIs in favor of new approaches that will better support the future, concurrent model for rendering. These deprecated APIs will eventually be removed, so it makes sense to avoid them in new code and move away from them in existing code. In this lesson, we’ll wrap our boilerplate application in the StrictMode component and see it in action.

Carlos Núñez
Carlos Núñez
~ 2 years ago

For now life-cycle methods are just legacy, not deprecated https://github.com/yannickcr/eslint-plugin-react/pull/1750#issuecomment-425975934

Brendan Whiting
Brendan Whiting
~ 2 years ago

I'm not getting the error about componentWillMount being deprecated. Using react 16.7.0

Doma
Doma
~ 2 years ago

No get the error message about componentWillMount of using react16.8.2 version, too.

Vincent Roman
Vincent Roman
~ 2 years ago

This is because you need to be using 17 and above to get the error.

Hafeez Syed
Hafeez Syed
~ 2 years ago

I only get the deprecation error when I remove settings: {react: {version: 'xx.xx.x'}} from .eslintrc.json.

So, should we add react {version: 'xx.xx.x'} or not ?

Kamil L
Kamil L
~ 2 years ago

This is working settings for legacy features like componentWillMount

  "settings": {
    "react": {
      "version": "16.999.0"
    }
  },
Janis
Janis
~ 2 years ago