使用Mobx在其他函数中调用函数

时间:2017-12-30 02:52:11

标签: javascript mobx mobx-react

在React Native中使用简单的Mobx Store,并试图弄清楚为什么我无法使用它。我有一个函数,我想调用另一个函数来inatlize数据库监听器

非常简单

class Store {
 @action FirstFunction(){
  this.SecondFunction();
   // I also tried:
    SecondFunction();
   //neither worked
 }

 @action SecondFunction(){
   console.log("Second Function!");
 }

}

有什么想法吗?在mobx中这可能吗? 无法弄清楚为什么它不会......

1 个答案:

答案 0 :(得分:0)

使用 1. HibernatePagingItemReader 2. HibernateCursorItemReader 3. JpaPagingItemReader 4. JdbcPagingItemReader 5. JdbcCursorItemReader 有效,但您必须确保this的值是您期望的值。

示例(JSBin

this