docs.unity3d.com
    Show / Hide Table of Contents

    Namespace Unity.AppUI.Redux

    Classes

    Action

    An action without a payload.

    Action<TPayload>

    An action with a payload.

    ActionCreator

    An action creator.

    ActionCreator<TPayload>

    An action creator with a payload.

    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.

    Slice

    A Slice is a collection of reducers and actions for a specific part of the application state.

    Slice<TState>

    A Slice is a collection of reducers and actions for a specific domain. It is a convenient way to bundle them together for use in a Redux store.

    SliceReducerSwitchBuilder<TState>

    The Slice Reducer Switch Builder is used to build a reducer switch statement via method chaining. This builder does not require you to create Action Creators. It will automatically create them for you.

    Store

    A store holds the whole state tree of your application. The only way to change the state inside it is to dispatch an action on it. Your application should only have a single store in a Redux app. As your app grows, instead of adding stores, you split the root reducer into smaller reducers independently operating on the different parts of the state tree.

    The store has the following responsibilities:

    • Holds application state
    • Allows access to state via GetState<TState>(String)
    • Allows state to be updated via Dispatch(Action)
    • Registers listeners via Subscribe<TState>(String, Action<TState>)
    • Handles unregistering of listeners via the function returned by Subscribe<TState>(String, Action<TState>)

      Here are some important principles you should understand about Reducers:

    • Reducers are the only way to update the state.
    • Reducers are pure functions that take the previous state and an action, and return the next state.
    • Reducers must be pure functions. They should not mutate the state, perform side effects like API calls or routing transitions, or call non-pure functions.
    • Reducers must not do asynchronous logic.
    • Reducers must not call other Reducer.
    • Reducers must not call Subscribe<TState>(String, Action<TState>).
    • Reducers must not call GetState<TState>(String)
    • Reducers must not call Dispatch(Action)

    Delegates

    ActionMatcher

    A predicate function that takes an action and returns true if the action should be handled by the reducer.

    CaseReducer<TState>

    A function that takes the current state and an action, and returns a new state.

    CaseReducer<T, TState>

    A function that takes the current state and an action, and returns a new state.

    Reducer

    A function that takes the current state and an action, and returns a new state.

    Unsubscriber

    A function obtained from Subscribe<TState>(String, Action<TState>) that can be called to unsubscribe the listener.

    In This Article
    • Classes
    • Delegates
    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