为何打印出来的顺序是31232?是不是我写的不对?class Home extends Component { constructor(props) { super(props); console.log(1) this.props.actions.fetchTopics({type: 'excellent'}) } render() { console.log(2) return ( <div> xxx </div> ); }}const mapStateToProps = state => { console.log(3) const { postsByReddit } = state let topics = [], results = postsByReddit['results'] if (results) topics = results.topics return { topics }}export default connect( mapStateToProps, mapDispatchToProps)(Home);
1 回答

慕侠2389804
TA贡献1719条经验 获得超6个赞
31232分为两部分
一、312 第一次渲染组件props——>constructor——>render
二、32 组件更新props——>render
添加回答
举报
0/150
提交
取消