Urunium.Redux 0.0.1

Redux implementation in c#. Redux is a predictable state container made popular by http://redux.js.org/ in the js world. Urunium.Redux is redux implementation for .net framework, which tries to implement redux in more c# idiomatic manner. Prior arts: Redux.Net, reducto.

Install-Package Urunium.Redux -Version 0.0.1
dotnet add package Urunium.Redux --version 0.0.1
<PackageReference Include="Urunium.Redux" Version="0.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Urunium.Redux --version 0.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
public class Reducer : IReducer<int>
{
	public int Apply(int previousState, object action)
	{
		switch(action)
		{
			case string action when action == "+":
				return previousState + 1;
			case string action when action == "-":
				return previousState - 1;
		}
	}
}
// Now assign reducer to store and dispatch actions:
Store<int> store = new Store<int>(new Reducer(), 0);
store.Dispatch("+");
Console.WriteLine(store.State); // Should be 1
store.Dispatch("+");
Console.WriteLine(store.State); // Should be 2
store.Dispatch("-");
Console.WriteLine(store.State); // Should be 1
store.Dispatch("-");
Console.WriteLine(store.State); // Should be 0
public class Reducer : IReducer<int>
{
	public int Apply(int previousState, object action)
	{
		switch(action)
		{
			case string action when action == "+":
				return previousState + 1;
			case string action when action == "-":
				return previousState - 1;
		}
	}
}
// Now assign reducer to store and dispatch actions:
Store<int> store = new Store<int>(new Reducer(), 0);
store.Dispatch("+");
Console.WriteLine(store.State); // Should be 1
store.Dispatch("+");
Console.WriteLine(store.State); // Should be 2
store.Dispatch("-");
Console.WriteLine(store.State); // Should be 1
store.Dispatch("-");
Console.WriteLine(store.State); // Should be 0

Release Notes

0.0.1 - Initial release contains: Redux core implementation, Subtree reduction, Enhancers, Logic

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
0.0.1 280 11/6/2017