React中的ajax请求为什么建议在componentDidMountz中调用呢,为什么不是在componentWillMount中呢?而且在componentWillMount中调用只会触发一次render,不是更好么
收起
看实际情况的需要,didMount在render之后,如果只是获取数据然后暂存,那么在何时调用均可。
事件调用顺序图。http://group.store.qq.com/qun/f8cP53hISgd.vIl4PP1GEA!!/V3t*yI5H5Ozvlci7psH/800?w5=640&h5=705&rf=viewer_421
报告相同问题?