this.props.promise.then 不是函数错误。为什么?
constructor(props) {
super(props);
this.state = {
loading: true,
error: null,
data: []
};
}
componentDidMount() {
this.props.promise.then(
value => this.setState({loading: false, data: value}),
error => this.setState({loading: false, error: error}));
}
组件调用:
<Child promise={this.state.data} />
this.state.data 是一个数组
提前致谢!