Skip to content

Commit

Permalink
feat(Example/Todo): define ActionCreator
Browse files Browse the repository at this point in the history
  • Loading branch information
mattak committed Dec 27, 2016
1 parent 0afdc45 commit b9841f6
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ public class Action
public VisibilityFilter Filter;
}

public static class ActionCreator
{
public static Action SetVisibility(VisibilityFilter filter)
{
return new Action()
{
ActionType = ActionType.SET_VISIBILITY,
Filter = filter,
};
}
}

public static State Reducer(State state, Action action)
{
switch (action.ActionType)
Expand All @@ -27,7 +39,6 @@ public static State Reducer(State state, Action action)

public static TodoState SetVisibility(TodoState state, VisibilityFilter filter)
{
// TODO: be immutable
state.Filter = filter;
state.SetStateChanged();
return state;
Expand Down

0 comments on commit b9841f6

Please sign in to comment.