Redux Can';t读取属性';绑定&x27;未定义的
操作系统:Windows 10 ProRedux Can';t读取属性';绑定&x27;未定义的,redux,react-redux,apollo,react-apollo,Redux,React Redux,Apollo,React Apollo,操作系统:Windows 10 Pro 阿波罗客户机:1.9.2 反应还原:5.0.6 因此,我试图将graphql结果集“连接”到redux,但收到上述错误消息。我的代码如下: 从'react redux'导入{connect}; 类PhotoGrid扩展了React.Component{ 渲染(){ const{data}=this.props; const isNewPage=this.props.location.pathname.includes('new'); if(数据加载){
阿波罗客户机:1.9.2
反应还原:5.0.6 因此,我试图将graphql结果集“连接”到redux,但收到上述错误消息。我的代码如下:
从'react redux'导入{connect};
类PhotoGrid扩展了React.Component{
渲染(){
const{data}=this.props;
const isNewPage=this.props.location.pathname.includes('new');
if(数据加载){
返回加载…;
}
if(data.error){
返回{data.error.message};
}
返回(
总记录计数:{data.\u AllPostSeMeta.count}
{data.allPostses.map((post,i)=>)}
{isNewPage&&(
this.previousPage()}>
以前的
this.nextPage()}>
下一个
)}
);
}
};
const allPostsCommentsQuery=graphql(所有帖子、评论、查询、{
选项:ownProps=>{
const page=parseInt(ownProps.match.params.page,10);
const isNewPage=ownProps.location.pathname.includes('new');
const skip=isNewPage?(第1页)*parseInt(每页产品):0;
const first=isNewPage?parseInt(每页产品):parseInt(每页产品);
const orderBy=isNewPage?orderBy:null;
fetchPolicy:'仅限网络';
返回{
变量:{
__离线:是的,
第一,
跳过
订购人,
},
}
},
});
导出默认连接(allPostsCommentsQuery)(PhotoGrid)
您有onclick函数它们是在父元素中定义的吗??您需要将它们绑定到构造函数中以导出默认组合(allPostsCommentsQuery,connect(/*REDUX STUFF HERE*/)(PhotoGrid)