Interface ISwitchBuilder<TBuilder, TState>
Definition of a switch statement builder to generate a Reducer.
Namespace: Unity.AppUI.Redux
Assembly: Unity.AppUI.Redux.dll
Syntax
public interface ISwitchBuilder<out TBuilder, TState>
Type Parameters
Name | Description |
---|---|
TBuilder | The type of the builder. |
TState | The type of the state. |
Methods
AddCase(IActionCreator, Reducer<TState>)
Adds a case to the reducer switch statement.
Declaration
TBuilder AddCase(IActionCreator actionCreator, Reducer<TState> reducer)
Parameters
Type | Name | Description |
---|---|---|
IAction |
actionCreator | The action creator for the action type you want to handle. |
Reducer<TState> | reducer | The reducer function for the action type you want to handle. |
Returns
Type | Description |
---|---|
TBuilder | The builder instance to chain calls. |
AddCase<TPayload>(IActionCreator<TPayload>, Reducer<TPayload, TState>)
Adds a case to the reducer switch statement.
Declaration
TBuilder AddCase<TPayload>(IActionCreator<TPayload> actionCreator, Reducer<TPayload, TState> reducer)
Parameters
Type | Name | Description |
---|---|---|
IAction |
actionCreator | The action creator for the action type you want to handle. |
Reducer<TPayload, TState> | reducer | The reducer function for the action type you want to handle. |
Returns
Type | Description |
---|---|
TBuilder | The builder instance to chain calls. |
Type Parameters
Name | Description |
---|---|
TPayload | The type of the action payload. |
GetActionCreators()
Create a dictionary of action creator per action type.
Declaration
Dictionary<string, IActionCreator> GetActionCreators()
Returns
Type | Description |
---|---|
Dictionary<string, IAction |
The dictionary of action creators. |
GetReducer()
Get the reducer output function.
Declaration
Reducer<TState> GetReducer()
Returns
Type | Description |
---|---|
Reducer<TState> | The reducer function. |