Skip to content

Documentation / @frak-labs/react-sdk / useDisplayModal

Function: useDisplayModal()

useDisplayModal<T>(args?): UseMutationResult<ModalRpcStepsResultType<T>, FrakRpcError<undefined>, DisplayModalParamsType<T> & { placement?: string; }, unknown>

Defined in: react/src/hook/useDisplayModal.ts:51

Hook that return a mutation helping to display a modal to the user

It's a `tanstack` wrapper around the `displayModal()` action

Type Parameters

T

T extends ModalStepTypes[] = ModalStepTypes[]

The modal steps types to display (the result will correspond to the steps types asked in params) An array of `ModalStepTypes` If not provided, it will default to a generic array of ModalStepTypes

Parameters

args?

Optional config object with mutations for customizing the underlying `useMutation()`

mutations?

MutationOptions<T>

Optional mutation options, see `useMutation()` for more infos

Returns

UseMutationResult<ModalRpcStepsResultType<T>, FrakRpcError<undefined>, DisplayModalParamsType<T> & { placement?: string; }, unknown>

The mutation hook wrapping the displayModal() action The mutate and mutateAsync argument is of type `DisplayModalParamsType<T>`, with type params T being the modal steps types to display The data result is a `ModalRpcStepsResultType`

See