react-amplitude icon indicating copy to clipboard operation
react-amplitude copied to clipboard

Rename unsafe lifecycles

Open Sabir001 opened this issue 5 years ago • 3 comments

componentWillMount and componentWillReceiveProps are not recommended to use. From React 17.x, only the UNSAFE_ name will work. UNSAFE alias was introduced in React version 16.3.

Had to also disable eslint for camelcase rule.

In the future, we can use componentDidMount instead of componentWillMount and componentDidUpdate instead of componentWillReceiveProps.

Sabir001 avatar Oct 17 '19 09:10 Sabir001

I think we should fix the underlying problem considering how little amplitude communicates.

ljmerza avatar Oct 17 '19 12:10 ljmerza

I think we should fix the underlying problem considering how little amplitude communicates. Related to unsafe lifecycles?

I think we should replace these lifecycle methods. We should use componentDidMount instead of componentWillMount and componentDidUpdate instead of componentWillReceiveProps.

But, that should be properly tested. So, before making that change I think we should just use the UNSAFE prefix first so that anyone can jump to 17.x when it arrives.

Sabir001 avatar Oct 20 '19 03:10 Sabir001

Can this be merged soon so I stop seeing warnings? :)

Jdban avatar Sep 10 '20 23:09 Jdban