I have some question that is about using ES6 class in react.
The question is as follows.
About creating component in react,
I am using this way.
class A extends Component{
constructor(){
this.state = {
'blah' : 123
}
}
}
but i saw other way.
class A extends Component{
state = {
'blah' : 123
}
}
question 1)
what is difference between first way and second way?
question 2)
In the environment I built,
The second method generates an error.
how to use second way? (directly defining state)