Skip to content
Advertisement

Why export default doesn’t work in this simple code?

Why when I use export default on index.js module it says: export ‘appReducers’ (imported as ‘appReducers’) was not found in ‘./reducers/index’ (possible exports: default), but when I change it to module.exports the error go away, why is that?

At redux.js

JavaScript

in index.js

JavaScript

in app.js

JavaScript

Advertisement

Answer

The problem is in redux.js. Instead of

JavaScript

You need

JavaScript

What you were doing before was a named import, not a default import.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement