Skip to content

Instantly share code, notes, and snippets.

@olexale
Last active August 2, 2017 19:22
Show Gist options
  • Save olexale/b2de385e22a3e2b6fff1ac5cabfa029f to your computer and use it in GitHub Desktop.
Save olexale/b2de385e22a3e2b6fff1ac5cabfa029f to your computer and use it in GitHub Desktop.
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