react es6 怎么设置默认的 state和props的方法
1state在constructor方法里写...
constructor(props) {
this.state = {
n: ...
}
}2 写default props有两种方法//1 在组件内部的使用static
...
static defaultProps = {
name: ...
}
//2 在组件外部
Hello.defaultPro...
原创
2018-04-15 20:57:53 ·
5066 阅读 ·
0 评论