This version (v0.7) has not been published to npm yet.
Skip to content

Reference / @getenginex/sdk-react / useEnginexMutations

useEnginexMutations() ​

Call Signature ​

useEnginexMutations(): CoreMutations

Core mutations, memoized per client: the same object across renders while the EnginexProvider client stays the same. Each call (m.deposits.createPix()) returns the mutation options; call it on every render and pass it to useEnginexMutation.

With (factory, product) it returns the mutations of a product package (see the other signature).

Returns ​

CoreMutations

The core mutations.

Throws ​

If called outside an EnginexProvider.

Example ​

ts
const m = useEnginexMutations()
const pix = useEnginexMutation(m.deposits.createPix())

Call Signature ​

useEnginexMutations<P, M>(factory, product): M

Mutations of a product package (createIgamingMutations, createPredictionsMutations), memoized per factory and product: the same object across renders while both stay the same.

Type Parameters ​

P ​

P

M ​

M

Parameters ​

factory ​

(product) => M

Product factory, e.g. createIgamingMutations.

product ​

P

The product object, e.g. the one returned by createIgaming(enginex).

Returns ​

M

The product mutations.

Throws ​

If called outside an EnginexProvider.

Example ​

ts
const im = useEnginexMutations(createIgamingMutations, igaming)
const redeem = useEnginexMutation(im.loyalty.redeem())