我正在玩React和Redux,并遇到了连接问题。React + Redux:状态undefined
const AppConnected = connect((state) => {text: state.text})(App);
在第一个示例中,我收到错误消息Cannot get 'text' of undefined
,而第二个示例运行没有问题。这背后的原因是什么?
const AppConnected = connect((state) => {
return {
text: state.text
}
})(App);