异步请求回来数据了,但是页面没有渲染
async componentDidMount() {
// 异步的请求一定要保证请求回来的数据是确切的。 使用async,await变成同步。
await this.props.PublishManageStore.fetchArticleList({
productCode,
bid: window.AMBASSADOR_CONFIG.bid
},code);
}
const renderName = ()=> {
return <spsan>{this.props.store.commodityName}</span>
}
<div>{renderName()}</div>
加上 async await 完美解决。