1

I have been trying to refactor Some existing React-Reflux code to ES-6 syntax,

I have 3 Stores for people, Projects and events. They Do basically the same thing but call different apis to fetch results.

so I tried to do the following :

class ResultStore extends Reflux.Store {
    constructor(resultsAPI){
        super();
        //initializations
    }
}
class PeopleResultStore extends ResultStore {
    constructor(){
        super('peopleBySkill');
    }
}

But this started throwing error "Super expression must either be null or a function, not undefined" at random places (mostly at Export statements of totally unrelated stores) in the code base. I'm using version 0.14.3 of React and 0.3.0 of Reflux

  • Where are you getting `Reflux.Store`? It's not exposed by reflux is it? I know they have `createStore`, but the `Store` function is internal in that – Dominic Jan 05 '16 at 15:23
  • @Dominic I found this here [link](https://github.com/reflux/refluxjs/issues/225), I went through Reflux-Store and you are right, Store is not exposed, any suggestions on what to do now?? – ashish kumar Jan 06 '16 at 07:07
  • It looks like the author doesn't like ES6 classes and Reflux is based heavily around mixins and factory functions, in other words unless you write your own class-based store I don't think it's possible. Also Reflux doesn't get much development activity - it will hinder you if you want to move over to classes, you may have to switch to something else or not use classes – Dominic Jan 06 '16 at 09:36
  • @DominicTobias - Reflux does now (just recently) implement ES6 style classes and stores. Docs here: https://github.com/reflux/refluxjs#react-es6-usage – BryanGrezeszak Jul 16 '16 at 16:31

1 Answers1

2

Reflux.Store and Reflux.Component for ES6 usage are just now newly implemented features that can be used in Reflux. The page you previously mention was just someone mentioning they want a feature like that. It had not been implemented at the time, and the things discussed on that page are not necessarily reflective of exactly how it was implemented.

The documentation of how they are currently implemented is here: https://github.com/reflux/refluxjs#react-es6-usage

BryanGrezeszak
  • 577
  • 2
  • 8