I have a simple createreactapp that I want to test reflux with, instead of redux, and I'm trying to include Reflux into it. I checked the spelling of .Component and .Store and class structure but still.
When I run it it gives me this error:
TypeError: Super expression must either be null or a function.
is reflux just too old for createreactapp? is it a webpack error? babel?
Full error:
inherits.js:4 Uncaught TypeError: Super expression must either be null or a
function
at _inherits (inherits.js:4)
at statStore.js:7
at Module../src/statStore.js (statStore.js:7)
at __webpack_require__ (bootstrap:782)
at fn (bootstrap:150)
at Module../src/Compass.js (index.css:8)
at __webpack_require__ (bootstrap:782)
at fn (bootstrap:150)
at Module../src/index.js (index.css?02e3:45)
at __webpack_require__ (bootstrap:782)
at fn (bootstrap:150)
at Object.0 (statStore.js:42)
at __webpack_require__ (bootstrap:782)
at checkDeferredModules (bootstrap:45)
at Array.webpackJsonpCallback [as push] (bootstrap:32)
at main.chunk.js:1
stateStore.js
import React from 'react';
import actions from './actions';
import Reflux from 'reflux';
class statStore extends Reflux.Store {
constructor(props){
super(props);
this.state = {
status:0
}
this.listenables = actions;
}
onStateUpdate2(){
this.setState({status:2})
console.log('stateupdate2')
}
onStateUpdate3(){
this.setState({status:3})
console.log('stateupdate3')
}
}
export default statStore;
compass.js
import React from 'react';
import actions from './actions';
import statStore from './statStore';
import Reflux from 'reflux';
class Compass extends Reflux.Component {
constructor(props){
super(props);
//this.store = statStore;
}
render(){
console.log('BAHAHHA')
return(<div onClick={actions.stateUpdate2}>{this.state.status}</div>)
}
}
export default Compass;
index.js
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import Compass from './Compass';
ReactDOM.render(<Compass />, document.getElementById('root'));
yes uhmm I actually deleted the serviceWorker from createreactapp and that was the cause.