state={
newAddress: this.props.address,
}
-------------------------------------------------------------------------------------------------
constructor(props){
super(props);
this.state={
newAddress: this.props.address,
}
}
关于上面两种写法,是否结果是第一种newAddress能取到值,而第二种值会是undefined。
https://www.babeljs.cn/repl/
可以看一下
babel
编译后的结果 并没有区别