ContextActions (Product Recommendation Engine)
ContextActions (Product Recommendation Engine)
This is for:
DeveloperThe context action creators.
See Dispatch Actions.
Loader Function
loadContextActions
Loads the context
reducer and returns possible action creators.
Parameters
-
engine:
CoreEngine
The headless engine.
Returns ContextActionCreators
: The context action creators.
ContextActionCreators
addContext
Adds a new context value.
Parameters
-
payload:
AddContextActionCreatorPayload
The action creator payload.
Returns PayloadAction<AddContextActionCreatorPayload>
: A dispatchable action.
removeContext
Removes a context key-value pair.
Parameters
-
key:
string
The key to remove from the context (for example, "age").
Returns PayloadAction<string>
: A dispatchable action.
setContext
Sets the query context.
Parameters
-
payload:
Record<string, ContextValue>
The action creator payload.
Returns PayloadAction<ContextPayload>
: A dispatchable action.
Related Types
AddContextActionCreatorPayload
Properties
-
contextKey:
string
The name of the key to store the context value in.
-
contextValue:
string | string[]
The context value.