在关于state取值的问题:
getComponent = () => {
service.getComponent().then((response)=>{
this.setState({
opition:[response.data]
});
});
}
render() {
{this.getComponent()}
const a = this.state.opition
return (
<Tree defaultExpandAll={true} draggable onDrop={this.onDrop}>
{this.loop(this.props.routeTree,true)}
</Tree>
)
}
为什么下面的a取不到值?刚接触react没几天。。求大神解答一下疑惑 谢谢!