Javascript 参数值已发送到但未被操作接收
我通过以下操作启动加载扫描:Javascript 参数值已发送到但未被操作接收,javascript,reactjs,ecmascript-6,redux,react-redux,Javascript,Reactjs,Ecmascript 6,Redux,React Redux,我通过以下操作启动加载扫描: export function loadPickingScans (orderReference) { return { type: SCANNING_LOAD_SCANS, orderReference }; } 它在我的智能(页面)组件中被称为: componentDidMount() { const { loadPickingScans } = this.props; loadPickingScans(this.props.match
export function loadPickingScans (orderReference) {
return { type: SCANNING_LOAD_SCANS, orderReference };
}
它在我的智能(页面)组件中被称为:
componentDidMount() {
const { loadPickingScans } = this.props;
loadPickingScans(this.props.match.params.orderReference);
}
这是url:
在此处输入代码
此.props.match.params.orderReference正确包含我的订单参考
但是,如果将日志添加到我的操作中,orderReference将作为未定义的
接收
我应该怎么做才能收到这个期望值
更新
应要求:
function mapDispatchToProps(dispatch) {
return {
loadPickingScans: () => dispatch(loadPickingScans())
};
}
在
mapDispatchToProps
中,在分派操作时,您没有向它传递任何参数,因此它在方法中记录为未定义,您需要像这样编写它
function mapDispatchToProps(dispatch) {
return {
loadPickingScans: (value) => dispatch(loadPickingScans(value))
};
}
或者干脆
const mapDispatchToProps = {
loadPickingScans
}
你能分享页面组件的代码吗?你能告诉你mapDispatchToPropsQuestion更新了吗?是的,我的便士掉了,因为你要求这个信息,但很好的捕获!很高兴能帮忙:-)