Current section: Mutations 7 exercises

Button Forms Data


00:00 Now, we've got a button that says Delete, and when you click on it, nothing happens. That's because this button is nothing special. The capital button here, this component is really just something to make it look styled with this destructive variant that we have.

00:16 But we need some on-click or something to handle this. Now, we're not going to use an on-click because that does not progressively enhance, and what we're really trying to do is do a network request to actually delete this note, and so we're going to use a form instead. We're going to wrap this button inside of a form

00:36 and then add an action to this route so that we can handle this deletion. So that's your job. That's what you're going to do. Give that a whirl, and once you have successfully completed this, you should be able to delete all of these notes. If you do end up deleting all of them and you still need to test it or something, then just stop the server, start it up again,

00:56 and because this database all lives in memory, you'll have all those notes back again. So give that a shot, and we'll see you when you're done.