DoneRedux 0.1.1
dotnet add package DoneRedux --version 0.1.1
NuGet\Install-Package DoneRedux -Version 0.1.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="DoneRedux" Version="0.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add DoneRedux --version 0.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: DoneRedux, 0.1.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install DoneRedux as a Cake Addin
#addin nuget:?package=DoneRedux&version=0.1.1
// Install DoneRedux as a Cake Tool
#tool nuget:?package=DoneRedux&version=0.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
<h1>Done Redux</h1>
What is Done Redux?
Done Redux is a combined state management framework based on Redux and .Net7, namely Donet Redux. It is suitable for building .NET applications.
It has four characteristics:
- Functional Programming
- Predictable State
- Componentization
- Flexible assembly
Documentation
Installation
- Initialization state, reducer, container
- Monitor subscriptions
- initiate commands
using Redux;
var state = CounterState.initState();
var reducer = CounterReducer.buildReducer();
var store = StoreCreator.createStore<CounterState>(state, reducer);
store.Subscribe(() =>
{
var lastState = store.GetState();
var stateJson = System.Text.Json.JsonSerializer.Serialize(lastState);
Console.WriteLine($"[Subscribe] last-state:{stateJson}");
});
store.Dispatch(CounterActionCreator.add(1));
store.Dispatch(CounterActionCreator.minus(2));
internal class CounterReducer
{
internal static Reducer<CounterState> buildReducer()
{
var map = new Dictionary<Object, Reducer<CounterState>>();
map.Add(CounterAction.add, _add);
map.Add(CounterAction.minus, _minus);
return Converter.asReducers<CounterState>(map);
}
private static CounterState _minus(CounterState state, Redux.Action action)
{
CounterState? newState = state.Clone(); //clone
newState.Count -= action.Payload;
return newState;
}
private static CounterState _add(CounterState state, Redux.Action action)
{
CounterState? newState = state.Clone(); //clone
newState.Count += action.Payload;
return newState;
}
}
internal enum CounterAction
{
add,
minus,
}
internal class CounterActionCreator
{
internal static Redux.Action add(int payload)
{
return new Redux.Action(CounterAction.add, payload);
}
internal static Redux.Action minus(int payload)
{
return new Redux.Action(CounterAction.minus, payload);
}
}
[Serializable]
internal class CounterState
{
public int Count { get; set; } = 0;
public static CounterState initState()
{
var state = new CounterState();
return state;
}
}
Example
- Counter - a simple counter demo.
- Composite - a composite demo .
- Todo List - a simple todo list demo.
License
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net7.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Release v0.1.1