Loading
Current section: Mutations 7 exercises
Problem

Handling Multiple Actions in a Single Action Function

Transcript

00:00 So right now our action is just doing one thing, it's just deleting, but it could be that we'll add another button in the future to favorite a note, for example. Or there are all sorts of things that we could add to this page that says I want some more mutations that can be performed. Now, there are a couple of ways to do this. There's something that I call

00:19 full stack components that you can read about elsewhere. But most of the time, that's not entirely necessary and we can just handle multiple actions inside of the single action function. You can only export one action, that's just the way JavaScript works, you can only export one of these. However, you can handle those different actions,

00:39 those different intended actions inside of this action function. So that's going to be your job for this exercise, is to add a little bit of extra information into the form submission so that we can distinguish between different potential intended actions that could take place. So have a good time with that

00:59 and we'll see you when you're done.