score:0

my guess is that you're trying to run that code without compiling it first. the es6 import/export syntax is still not natively supported in most environments - es6 modules have to be compiled to another format first, usually using babel.

score:0

this is improper syntax. you need to add the function keyword before the function signature, or define it as an arrow function like sam suggested.

i.e. export default function (state = init_state, action) {...} or export default (state = init_state, action) => {...}, instead of export default (state = init_state, action) {...}

score:1

this happens when you have multiple exports on the same file and you add a default export to one of them , so the solution is either to export one module by using export default or just export if you want to export multiple objects , functions...etc in the same file

another thing to mention is the way you call a function , es6 introduces the arrow function

instead of this (arg1 , arg2 ){ .... } you should do this (arg1 , arg2 ) => {.....}

so for your case

   const init_state = [];

export (state = init_state, action) => {

switch(action.type) {
    default: state
  }
}

Related Query

More Query from same tag