Forgive me, I am relatively new to reactJS, but going through multiple tutorials including those on the official website, I am quite confused. It seems there has been a ton of updates in the past few years for reactJS, and everyone is using different conventions. I wanted to get some clarity here on a few concepts.
1) Constructors: The reactJS official docs still use a constructor such as the following:
const MyComponent extends React.Component {
constructor(props) {
super(props)
this.state = {
points: 0
}
But from what I have seen in different more recent tutorials, it is much simplified into the following:
const MyComponent extends React.Component {
state = {
points: 0
}
}
Is the official reactJS website just outdated and I should always use the second way? (constructors/super(props) are not needed?) Seems much simpler the second way for sure.
2) Binding Is binding also not needed anymore (due to the ability to use arrow functions?)? I am not exactly clear on the concept of binding, seems quite confusing, but seems some newer tutorials use arrow functions, not sure if there is any case now that needs to use the binding method.
3) Lifecycle methods Such as componentdidmount and such, have these changed at all? Or completely unchanged? Do I still need to use these functions? It seems componentwillmount is gone, but not sure about didmount.
Cheers and thanks