Props更新以后如何渲染?

#1

因为渲染组件传入的数据是异步去获取的,所以最先渲染组件的时候值基本都为空,当数据取回来的时候,应该怎么再次渲染一次组件?

/* a.js */
function App() {

    let goods = new GoodsInfo(),
        data = goods.init(); /* 异步获取数据 */

    return (
        <div>
            <Goods {...data} />
        </div>
    )
}
ReactDOM.render(<App />, document.querySelector("#ABC"))
/* b.js */
export default class Goods extends React.Component {

    constructor(props) {
       super(props)
    }

   /* 这里面压根就不知道如何写才能重新渲染  */

    render() {
        return (
            <div>{this.props.id}</div>
        )
    }
}
#2

在didmount里面重新setState

#3

React生命周期文档有写什么时候适合操作数据

componentDidComponent() {
    //fetch your data and change the state
}