Ich versuche, eine isomorphe/universelle App mit react + redux + express zu erstellen, und ich habe einige Probleme, den Speicher von server.js zu erstellen.Verwenden Sie Redux in einer isomorphen App
In server.js ich habe:
import { configureStore } from './store/configureStore';
const store = configureStore();
In meinem configureStore:
import { createStore, applyMiddleware } from 'redux';
import thunkMiddleware from 'redux-thunk';
import createLogger from 'redux-logger'
import rootReducer from '../reducers/index';
const createStoreWithMiddleware = applyMiddleware(thunkMiddleware)(createStore);
export default function configureStore(initialState) {
const store = createStoreWithMiddleware(rootReducer, initialState);
if (module.hot) {
// Enable Webpack hot module replacement for reducers
module.hot.accept('../reducers',() => {
const nextRootReducer = require('../reducers').default
store.replaceReducer(nextRootReducer)
})
}
return store;
}
Und ich bekomme diese Fehlermeldung:
TypeError: (0 , _configureStore.configureStore) is not a function
on line: const store = configureStore ();
Warum? was mache ich falsch?
Wenn nützliche Know sein kann, ist meine Verzeichnisstruktur wie folgt aus: - src - store ---- configureStore.js - server.js