尝试创建调度程序时出现 TypeError in flux
There is TypeError in flux whne try to create dispatcher
我尝试在 index.js
中导入这个 class
import Dispatcher from "flux";
import React from "react";
export class CountdownDispatcher extends Dispatcher {
handleAction(action) {
console.log("dispatching action:", action);
this.dispatch({
source: "VIEW_ACTION",
action
});
}
}
但是 reactjs 编译器首先在 raw 下划线并显示错误消息
Super expression must either be null or a function, not object
这是 React 和 redux 第 186 页中的示例
尝试像这样在 index.js 中导入:
import { CountDownDispatcher } from "./Flux/CountDownDispatcher";
从 "flux" 导入 {Dispatcher};
我尝试在 index.js
中导入这个 classimport Dispatcher from "flux";
import React from "react";
export class CountdownDispatcher extends Dispatcher {
handleAction(action) {
console.log("dispatching action:", action);
this.dispatch({
source: "VIEW_ACTION",
action
});
}
}
但是 reactjs 编译器首先在 raw 下划线并显示错误消息
Super expression must either be null or a function, not object
这是 React 和 redux 第 186 页中的示例
尝试像这样在 index.js 中导入:
import { CountDownDispatcher } from "./Flux/CountDownDispatcher";
从 "flux" 导入 {Dispatcher};