為何打印出來的順序是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);
使用react-redux打印的執(zhí)行順序
阿晨1998
2018-11-07 14:31:40