Closed pranavrajs closed 6 years ago
Normally I'd say this sort of thing is for stack overflow, but since this is the first time extending Reflux.Store multiple levels deep I'll take the chance to comment:
Basically yes (though remember it's Reflux.Store
, capital "S").
The most noticeable difference will be in the constructor, you don't want to declare your starting state as this.state = {foo:'bar'}
, because it'll completely replace any state made from the Store it inherited from (that's not really a Reflux specific thing, just a fact of inheritance of properties in general). You'd do more like this.state.foo = 'bar';
, since this.state
was already created in the super class, and you're just adding props to it.
jsfiddle example inheriting 3 levels deep: https://jsfiddle.net/92zz7o3m/22/
I have a situation where I have shared states and, actions which differs according to different view.
I am thinking of a SuperClass which extends RefluxStore and subclasses which extends Superclass.
For eg:
Is this correct ?