我正在使用 react-redux 进行状态管理并使用传递状态存储,provider
但我不知道为什么它在我的提供程序组件的消费者部分中以未定义的形式出现
render(){
return (
<Provider store = {store} >
<ApolloProvider client = {client} >
<div className="row">
<SideBar />
<Center />
<RightSlidePanel />
</div>
</ApolloProvider>
</Provider>
)
}
}
RightSLidePanel 组件
import { connect} from 'react-redux'
class RightSlidePanel extends React.Component{
constructor(){
super();
console.log("inside connect " + this.props);
}
//render method here
}
const mapStateToProps = state => {
return {
loggedInUser : state.loggedInUser
}
}
const mapDepatchToProps = dispatch =>{
return {
changeIsReduxWorking : answerTrueOrNot =>{
dispatch({
type : "CHANGE_REDUX_WORKING_STATUS",
data : answerTrueOrNot
});
}
}
}
export default connect(
mapStateToProps,
mapDepatchToProps
)(RightSlidePanel);
console.log 的结果是undefined
.