loading...

re: React - ES6 tricks in Classes VIEW POST

FULL DISCUSSION
 

Using constructor is not the old way, it's still a viable way to construct a state, and in the end this:

state = {
    value: ""
  }

is transpiled to this:

 constructor(props) {
    super(props);
    this.state = {
     value: ""
    };
  }

So. it's not the old way, it's just syntatic sugar.

Using arrow functions to bind methods to the class is really useful tho.

 

True story! :-) That is right!
I meant "old way" and "new way" like... we "used that way" and we "should use this way". :-)

Code of Conduct Report abuse