EditAction and CreateAction
There are two separate components for managing a specific stored action with @zapier/ai-actions-react
: EditAction
and CreateAction
.
CreateAction
should be used when you do not have an existing action that you want to edit, and EditAction
should be used when you know the ID of the action you want to edit.
Props
onActionSaved
This callback will be called with the updated action when the user clicks the “Save” button.
See the Get stored action documentation for more information about what the object contains.
actionId
Only for EditAction
This is the ID of the action that you want to edit. When the component renders, it will fetch the latest version of the action to edit from the API.
onActionDeleted
Only for EditAction
This callback wall be called with the ID of the action that was deleted when the user clicks the “Delete” button.
Usage
Make sure that this component is rendered unerneath an
AiActionsProvider
!
Example
This example uses the ActionList
component to show a list of action and lets you select an action to edit. It also lets you create new actions.