Echo JS 0.11.0

<~>

ben 2726 days ago. link 2 points
This method removes the possibility of Flow type hints.
ayatkevich 2726 days ago. link 2 points
That's a good point. I'll see what I can do to make the Flow type check possible again. Thanks.
stanley00 2727 days ago. link 1 point
The reason you declare your action types separately is so you can export them for use in your reducer.
ayatkevich 2726 days ago. link 1 point
You are right. That's why I added ability to get the type without instantiation of the action.

const setVisibilityFilter = action('SET_VISIBILITY_FILTER', 'filter');

function todoApp(state = initialState, action) {
  switch (action.type) {
    case setVisibilityFilter.type:
      return Object.assign({}, state, {
        visibilityFilter: action.filter
      });
    default:
      return state;
  }
}