Skip to main content

useDeposit

view on npm

A hook that accepts an original object, then allows you to edit it and run a save callback.

useDeposit(original, settings) ⇒

A hook that accepts an original object, then allows you to edit it and run a save callback.

Returns:

DepositControls - The controls of the deposit

ParamTypeDescription
original

the original value to edit

settings

The settings of this deposit

settings.onSavefunction

A callback function that will be called when the save function is called. NOTE: Must return a boolean indicating whether the save action was successful. NOTE: The param of this function ONLY returns the CHANGES to the original object. Any unchanged properties/values will not be included.

settings.onEditfunction

A callback function that will be called when the edit function is called.

settings.Discardfunction

A callback function that will be called when the discard function is called.

settings.autoSavenumber

The number of milliseconds to wait before saving.