小编sac*_*abu的帖子

无法使用选择器从Redux存储中获取值

我无法将redux存储值获取到props,我检查了reducers,store,action和JS文件,一切正常。但是,同时将选择器传递给mapStateToProps。

错误 得到这个错误

错误:未捕获(承诺)TypeError:Object(...)不是函数

at selectHosDeatilsResult (AddAppointment.js?0a10:319)

import React from 'react';
import { connect } from 'react-redux';
import { createSelector } from 'reselect';

 class example extends React.PureComponent {
  render() {
    console.log('this.props', this.props);
 return (
<div>
</div>
);
}
}
const selectHosDeatilsResult = () => createSelector(
  makeHospitalResult(),
  value => ({ value }),
);

const mapStateToProps = state => ({
details: selectDeatilsResult()(state),
});
export default connect(mapStateToProps, null)(example);
Run Code Online (Sandbox Code Playgroud)

减速器代码

const initialState = fromJS({
  hospitalResult: null,
});

export default function Reducer(state = initialState, action) { …
Run Code Online (Sandbox Code Playgroud)

javascript reactjs redux-saga

8
推荐指数
1
解决办法
74
查看次数

标签 统计

javascript ×1

reactjs ×1

redux-saga ×1