React hook used to interact with a Trixta reaction for a given roleName.
roleName : string
Required
Trixta role name
reactionName : string
Required
Trixta reaction name
requestForEffect: boolean
Optional
Defaults to false.
If set to true
, this Trixta reaction is not waiting for a response and the only expect to use the initialData
loadingStatusRef: string
Optional
Optional value to change the default isInProgress behaviour for when submitting reactions. If you plan to use the same reaction name for the same role, on the same screen, this is when you would make use of this * property
debugMode: boolean
Optional
Defaults to false.
If set to true
, enables Trixta console debugging
setTimeoutEventAsErrorEvent: boolean
Optional
Defaults to false.
If set to true
, will set the timeoutEvent
to be the same as the errorEvent
clearResponsesOnCallback: boolean
Optional
Defaults to false.
If set to true
, will clear all responses when onSuccess
or onError
callbacks are called returning a value true
onSuccess : (success: TSuccessType) => void|boolean
Optional
This function will fire any time a successful response is received from Trixta.
If you return true
and clearResponsesOnCallback is true
, all responses will be cleared.
onError : (error: TErrorType) => void|boolean
Optional
This function will fire any time an error response is received from Trixta.
If you return true
and clearResponsesOnCallback is true
, all responses will be cleared.
hasRoleAccess : boolean
Will be true
if the roleName
has access for this user.
isInProgress : boolean
Will be true
if there is no response yet after calling submitTrixtaReactionResponse
or submitTrixtaReaction
.
Will be false
if there is a response after calling submitTrixtaReactionResponse
or submitTrixtaReaction
hasResponse : boolean
Will be true
if there is at least one Trixta Instance response.
loading : boolean
Will be true
if the reaction is waiting to be loaded or receive a reaction.
latestResponse :
TrixtaReactionInstanceResponse
First or most recent Trixta instance response
initialData : TInitialData on
TrixtaReactionInstance
Initial data returned from Trixta reaction instance
latestInstance :
TrixtaReactionInstance
First or most recent Trixta instance
submitTrixtaReaction : (parameters:
SubmitTrixtaFunctionParameters
) => void
This function will submit a response for the given roleName
and reactionName
clearReactionResponses : () => void
This function will clear and reset responses for the given roleName
and reactionName
.
React hook used to interact with a Trixta reaction that does require a response for a given roleName. Will trigger the callBack when a reaction is received.
roleName : string
Required
Trixta role name
reactionName : string
Required
Trixta reaction name
debugMode: boolean
Optional
Defaults to false.
If set to true
, enables Trixta console debugging
hasRoleAccess : boolean
Will be true
if the roleName
has access for this user.
First or most recent Trixta instance
respondToReaction : (parameters: { data, instance, responseEvent, errorEvent }) => void
Required
This function will respond to the reaction with the data for the given parameters that is received from Trixta.
React hook used to interact with a Trixta reaction that does not require a response for a given roleName. Will trigger the callBack when a reaction is received.
roleName : string
Required
Trixta role name
reactionName : string
Required
Trixta reaction name
debugMode: boolean
Optional
Defaults to false.
If set to true
, enables Trixta console debugging
callBack : (payload: TInitialData) => void
Required
This function will fire any time a reaction is received from Trixta.
hasRoleAccess : boolean
Will be true
if the roleName
has access for this user.
Trixta reaction related hooks can be found here.
latestInstance :