鍍金池/ 問答/HTML/ 為什么state.loginReducer.user輸出有數(shù)據(jù),在render里

為什么state.loginReducer.user輸出有數(shù)據(jù),在render里輸出取不到數(shù)據(jù)

已經(jīng)解決了,謝謝大家。

回答
編輯回答
未命名

你在componentWillReceiveProps方法中log一下,看看nextProps中究竟是什么,有沒有user這個(gè)對(duì)象?是不是nextProps.reducer.user

2018年7月1日 23:26
編輯回答
苦妄

應(yīng)該是這樣的:
這兩個(gè)state不是一個(gè)state render中的state是react管理的 selector中的state是redux管理的,你要是想拿到redux中的state需要通過this.props去拿

2018年6月12日 19:23