Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Redux在Meteor.call内调度或获取Meteor.call值_Javascript_Meteor_React Redux - Fatal编程技术网

Javascript Redux在Meteor.call内调度或获取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

我的项目与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: 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));
      }
})
因此,您不必处理
这个
关键字