using Flux;
using System;
namespace FluxSample {
class State {
private readonly int count;
public int Count => count;
public State(int count) {
this.count = count;
}
public override string ToString() {
return count.ToString();
}
}
class Increment : IAction<State> {
private readonly int by;
public Increment(int by = 1) {
this.by = by;
}
public State Reduce(State state) {
return new State(state.Count + by);
}
}
class Program {
static void Main(string[] args) {
Store<State> store = new Store<State>(new State(0));
store.OnStateChanged += () =>
{
Console.WriteLine(store.State.Count);
};
store.Dispatch(new Increment());
Console.ReadLine();
}
}
}
-
Notifications
You must be signed in to change notification settings - Fork 0
Redux-like implementation for .NET, inspired by Dart Redurx
License
raybarrera/raydux
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Redux-like implementation for .NET, inspired by Dart Redurx
Resources
License
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published