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.
Var allt tydligt?
Tack för dina kommentarer!
Avsnitt 6. Kapitel 7
Fråga AI
Fråga AI
Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal