Deleting an Item in the Database
Let's implement the delete functionality for the invoice.
Back to the Project
To utilize a Server Action for deleting an invoice, enclose the delete button within a <form>
element and transmit the id
to the Server Action using the bind
feature:
To complete the task, we create the deleteInvoice
action.
As you can see, we are not using redirect()
because the delete action is called on the dashboard/invoices
page.
In Practice
Video Player is loading.
Loaded: 0%
Current Time 0:00
/
Duration -:-
- , opens subtitles settings dialogsubtitles settings
- subtitles off
- , selectedEnglish Captions
1x
- 2x
- 1.5x
- , selected1x
- 0.5x
This is a modal window.
The media could not be loaded, either because the server or network failed or because the format is not supported.
Beginning of dialog window. Escape will cancel and close the window.
End of dialog window.
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 6. Capitolo 7
Chieda ad AI
Chieda ad AI
Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione