Namespace Unity.AppUI.Redux
Classes
Action
An action without a payload.
ActionCreator
An action creator.
ActionCreator<TPayload>
An action creator with a payload.
Action<TPayload>
An action with a payload.
AsyncThunkActionCreator<TPayload, TThunkArg>
The async thunk action creator.
AsyncThunkAction<TPayload, TThunkArg>
An action created by an async thunk action creator.
AsyncThunkOptions
Options for the async thunk.
AsyncThunkOptions<TThunkArg>
Options for the async thunk with arguments.
ConditionUnmetException
An action dispatched when the condition set in the options of the Async Thunk creation is not met.
FulfilledActionCreator<TPayload>
An Action Creator to create fulfilled actions for async thunks.
FulfilledAction<TPayload, TThunkArg>
An action dispatched when the thunk is fulfilled.
FulfilledMeta<TThunkArg>
The metadata of the thunk when it is fulfilled.
Meta<TThunkArg>
The metadata of the thunk.
PendingActionCreator<TPayload>
An Action Creator to create pending actions for async thunks.
PendingAction<TPayload, TThunkArg>
An action dispatched when the thunk is pending.
PendingMeta<TThunkArg>
The metadata of the thunk when it is pending.
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.
RejectedActionCreator<TPayload>
An Action Creator to create rejected actions for async thunks.
RejectedAction<TPayload, TThunkArg>
An action dispatched when the thunk is rejected with an optional payload.
RejectedMeta<TThunkArg>
The metadata of the thunk when it is rejected.
Slice
A Slice is a collection of reducers and actions for a specific part of the application state.
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.
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.
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)
StoreExtensions
Extensions for the Store.
ThunkAPI<TPayload, TThunkArg>
An interface to interact with the thunk during the execution. You can use this interface to abort the thunk, reject the thunk with a value, or fulfill the thunk with a value. You also have access to the store to dispatch new actions.
Enums
ThunkStatus
The status of the thunk.
Delegates
ActionMatcher
A predicate function that takes an action and returns true if the action should be handled by the reducer.
AsyncThunkActionCreator<TPayload, TThunkArg>.PayloadCreator
The payload creator signature for the thunk.
AsyncThunkOptions<TThunkArg>.ConditionHandler
A condition to check before dispatching the action.
AsyncThunkOptions<TThunkArg>.ConditionHandlerAsync
A condition to check before dispatching the action asynchronously.
AsyncThunkOptions<TThunkArg>.IDGeneratorHandler
A generator to create a unique ID for the request.
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.