Javascript Redux在Meteor.call内调度或获取Meteor.call值
我的项目与Meteor和react redux一起工作 要使redux工作,必须能够访问组件的this.props中的dispatch函数 但是,当我使用Meteor.call时,回调的Javascript Redux在Meteor.call内调度或获取Meteor.call值,javascript,meteor,react-redux,Javascript,Meteor,React Redux,我的项目与Meteor和react redux一起工作 要使redux工作,必须能够访问组件的this.props中的dispatch函数 但是,当我使用Meteor.call时,回调的属性不包含预期的redux函数dispatch 这是我的流星。呼叫: var testing; Meteor.call('seed', mergedobj, function(err, seed){ if(err){ console.log('ERROR ERROR ERROR: w
属性不包含预期的redux函数dispatch
这是我的流星。呼叫:
var testing;
Meteor.call('seed', mergedobj, function(err, seed){
if(err){
console.log('ERROR ERROR ERROR: when calling seed err', err);
if(err.error === 'SWE_RISE_TRANS_NEGATIVE'){
}
}else{
console.log('return of seed', seed)
console.log('this', this)
//this.props.dispatch(seedAction(seed))
testing = seed
}
})
console.log('testing', testing) //'INITIAL' and not seed!!
我需要更改回调的this
,以便在回调内部调用this.props.dispatch,或者需要在回调外部获取seed的值。。。。。
我如何做到这一点?
如何获取回调范围之外的seed inside变量的值?如何使用以下语法:
const dispatch = this.props.dispatch;
Meteor.call('seed', mergedobj, function(err, seed){
if(err){
// error handling here.
}else{
dispatch(seedAction(seed));
}
})
因此,您不必处理这个
关键字