Javascript 尝试创建dispatcher时,flux中存在TypeError
我尝试在index.js中导入这个类Javascript 尝试创建dispatcher时,flux中存在TypeError,javascript,reactjs,flux,Javascript,Reactjs,Flux,我尝试在index.js中导入这个类 import Dispatcher from "flux"; import React from "react"; export class CountdownDispatcher extends Dispatcher { handleAction(action) { console.log("dispatching action:", action); this.dispatch({ source: "VIEW_ACTIO
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
});
}
}
但在第一个raw下加上错误消息
超级表达式必须为null或函数,而不是对象
这是第186页“反应和重复使用”一书中的示例
尝试按如下方式在index.js中导入:
从“/Flux/CountDownDispatcher”导入{CountDownDispatcher}”
从“通量”导入{Dispatcher}