Last active
August 2, 2017 19:22
-
-
Save olexale/b2de385e22a3e2b6fff1ac5cabfa029f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CounterStore : INotifyPropertyChanged | |
{ | |
private readonly CounterReducer reducer = new CounterReducer(); | |
private CounterState state; | |
public CounterStore(CounterState initialState) | |
{ | |
state = initialState; | |
} | |
public CounterState State | |
{ | |
get { return state; } | |
private set { state = value; PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(State))); } | |
} | |
public void Dispatch(object action) | |
{ | |
State = reducer.Reduce(State, action); | |
} | |
public event PropertyChangedEventHandler PropertyChanged; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment