docs.unity3d.com
    Show / Hide Table of Contents

    Class ReducerSwitchBuilder<TState>

    The Reducer Switch Builder is used to build a reducer switch statement via method chaining. You must have created Action Creators for each action type you want to handle prior to using this.

    Inheritance
    Object
    ReducerSwitchBuilder<TState>
    Inherited Members
    Object.ToString()
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.ReferenceEquals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Namespace: Unity.AppUI.Redux
    Syntax
    public class ReducerSwitchBuilder<TState>
    Type Parameters
    Name Description
    TState

    The type of the state slice.

    Methods

    AddCase(ActionCreator, CaseReducer<TState>)

    Adds a case to the reducer switch statement.

    Declaration
    public ReducerSwitchBuilder<TState> AddCase(ActionCreator action, CaseReducer<TState> reducer)
    Parameters
    Type Name Description
    ActionCreator action

    The action creator for the action type you want to handle.

    CaseReducer<TState> reducer

    The reducer function for the action type you want to handle.

    Returns
    Type Description
    ReducerSwitchBuilder<TState>

    The Reducer Switch Builder.

    AddCase<T>(ActionCreator<T>, CaseReducer<T, TState>)

    Adds a case to the reducer switch statement.

    Declaration
    public ReducerSwitchBuilder<TState> AddCase<T>(ActionCreator<T> action, CaseReducer<T, TState> reducer)
    Parameters
    Type Name Description
    ActionCreator<T> action

    The action creator for the action type you want to handle.

    CaseReducer<T, TState> reducer

    The reducer function for the action type you want to handle.

    Returns
    Type Description
    ReducerSwitchBuilder<TState>

    The Reducer Switch Builder.

    Type Parameters
    Name Description
    T

    The type of the action payload.

    AddDefaultCase(CaseReducer<TState>)

    Adds a default case to the reducer switch statement. A default case is a case that will be executed if no other cases match.

    Declaration
    public ReducerSwitchBuilder<TState> AddDefaultCase(CaseReducer<TState> reducer)
    Parameters
    Type Name Description
    CaseReducer<TState> reducer

    The reducer function for the default case.

    Returns
    Type Description
    ReducerSwitchBuilder<TState>

    The Reducer Switch Builder.

    AddDefaultCase<T>(CaseReducer<T, TState>)

    Adds a default case to the reducer switch statement. A default case is a case that will be executed if no other cases match.

    Declaration
    public ReducerSwitchBuilder<TState> AddDefaultCase<T>(CaseReducer<T, TState> reducer)
    Parameters
    Type Name Description
    CaseReducer<T, TState> reducer

    The reducer function for the default case.

    Returns
    Type Description
    ReducerSwitchBuilder<TState>

    The Reducer Switch Builder.

    Type Parameters
    Name Description
    T

    The type of the action payload.

    AddMatcher(ActionMatcher, CaseReducer<TState>)

    Adds a matcher case to the reducer switch statement. A matcher case is a case that will be executed if the action type matches the predicate.

    Declaration
    public ReducerSwitchBuilder<TState> AddMatcher(ActionMatcher actionMatcher, CaseReducer<TState> reducer)
    Parameters
    Type Name Description
    ActionMatcher actionMatcher

    The predicate that will be used to match the action type.

    CaseReducer<TState> reducer

    The reducer function for the action type you want to handle.

    Returns
    Type Description
    ReducerSwitchBuilder<TState>

    The Reducer Switch Builder.

    AddMatcher<T>(ActionMatcher, CaseReducer<T, TState>)

    Adds a matcher case to the reducer switch statement. A matcher case is a case that will be executed if the action type matches the predicate.

    Declaration
    public ReducerSwitchBuilder<TState> AddMatcher<T>(ActionMatcher actionMatcher, CaseReducer<T, TState> reducer)
    Parameters
    Type Name Description
    ActionMatcher actionMatcher

    The predicate that will be used to match the action type.

    CaseReducer<T, TState> reducer

    The reducer function for the action type you want to handle.

    Returns
    Type Description
    ReducerSwitchBuilder<TState>

    The Reducer Switch Builder.

    Type Parameters
    Name Description
    T

    The type of the action payload.

    BuildReducer(TState)

    Builds the reducer switch statement.

    Declaration
    public Reducer BuildReducer(TState initialState)
    Parameters
    Type Name Description
    TState initialState

    The initial state of the reducer.

    Returns
    Type Description
    Reducer

    The reducer switch statement.

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023