javascript - React native alt dispatcher this.dispatch 不是函数 Babel 6

标签 javascript react-native babeljs

我今天早上将我的项目从 RN 0.15.0 升级到 0.16.0,并且由于传递到 Babel 6 而出现了许多错误。 有一个我不明白(我猜它在我的 .babelrc 文件中丢失了一些东西)

此代码在升级前运行良好:

'use strict';

import alt from '../alt';
import MeStore from '../stores/Me';

export class MeActions {
 showedCurrentPosition(showed) {
    this.dispatch(showed);
  }
}

export default alt.createActions(MeActions);

这是我使用插件 alt 的 Alt.js 文件:

'use strict';

import Alt from 'alt';
export default new Alt();

现在,我在调用 MeActions.showedCurrentPosition(true);

时运行我的代码时得到“this.dispatch is not a function”

Error thrown when running app

最佳答案

您可能最终也升级了 Alt。最近的一个版本取消了 dispatch,取而代之的是简单的返回。查看有关操作的文档 http://alt.js.org/docs/createActions/

关于javascript - React native alt dispatcher this.dispatch 不是函数 Babel 6,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34414619/

相关文章:

javascript - Chrome 不允许过期时间少于 4 小时的 cookie

javascript - 使 Chart.js 雷达标签可点击

react-native - 自定义标签栏 React 导航 5

javascript - 映射单元格以在 HTML 表格中显示 JSON 数据

javascript - 将 div 作为数组项并添加到列表项

iphone - Pubnub + React Native - iOS 真实设备上没有横幅通知

java - 找不到模块 'react-transform-hmr/lib/index.js'

webpack - Babel 和 EventTarget 的子类

javascript - 使用 babel 解析器时,Eslint 禁用严格模式

javascript - "Parsing error: No babel config file detected"IDE在Vue项目根目录下打不开