Ad

There Is TypeError In Flux Whne Try To Create Dispatcher

- 1 answer

I try to import this class in 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_ACTION",
      action
    });
  }
}

But reactjs compiler underline first raw with error message

Super expression must either be null or a function, not object

This is example from book React and redux page 186

Try to import in index.js like this:

import { CountDownDispatcher } from "./Flux/CountDownDispatcher";

Ad

Answer

import {Dispatcher} from "flux";

Ad
source: stackoverflow.com
Ad