Switchcase made for REACTFLUX is not taking the right case

0

Why are not you getting the action.type? ends up in default.

The log is saying "editing" which is the default case rather than creating a new article.

The code

  handleActions(action) {
    switch (action) {
    case action.type === ActionTypes.CREATE_ARTICLE:
        this.setState.article.id = Counter.increment();
        this.setState.article.title = action.title;
        this.setState.article.content = action.content;
        console.log("adicionado")
        break;
    case action.type === ActionTypes.DELETE_ARTICLE:
        console.log("deletando")
        break;
    default:
        console.log("editando")
        break;
}
  }

Print log:

Intheimageabove,createtheobject,butthelogexitsthedefault"editing".

Code everything

    
asked by anonymous 11.07.2017 / 13:51

1 answer

0

It looks like flux does not have state and these components stops. I talked to the official team of team react and the best option for me is to play a game or go pro redux. I have only one thing to say: "Goodbye flux!"

    
11.07.2017 / 16:07