2

I'm learning React and cant make sense of how to get rid of the Eslint warning. I follow the link that are suggested in the popup message and there it just done say anything what I can understand.

I removed the super() call then Eslint warn that I must make a super call I read that the constructor is being removed from React. even that post is 3 year old dunno what to make of this.

I also tried this.state = this.parse(); outside the constructor and that did not work! Supposedly one should be able to do also this this.myHandler = this.myHandler.bind(this); outside of the constructor but it's not acccepted.

Any clarity on this would be nice enter image description here

Kid
  • 1,869
  • 3
  • 19
  • 48
  • Does your constructor take a second "context" parameter? I think that's the part that's deprecated. – ray Sep 11 '20 at 17:21
  • Dunno about second parameter. I reda in that article that constructor is being removed from React what is that about – Kid Sep 11 '20 at 18:07
  • I removed the constructor super() then Eslint complaint there was no constructor super() – Kid Sep 14 '20 at 14:04
  • 1
    This answer might help your concerns https://stackoverflow.com/questions/63856962/understanding-why-super-is-deprecated-in-a-react-class-component – Mandar Deshpande Sep 22 '20 at 07:34
  • Thanks @MandarDeshpande very useful! I just remove `props` argument from `super(props)` – Kid Sep 22 '20 at 07:47
  • This is a wrong warning and can be ignored ([src](https://stackoverflow.com/questions/63883401/react-native-context-and-deprecated-super-usage)) – eyalyoli Sep 22 '20 at 18:57

0 Answers0