- [Instructor] In this video we will use mapMutations
to modify our NewStudent component.
So below our submit call,
just like we did for our map getters,
we'll use the spread operator,
and then we'll use mapMutations,
and we will supply a list of the mutations we wish to map.
In this case we'll add addStudent,
and we need to pass that as a string.
Now let's comment out line 41,
and we'll add in this.addStudent,
and we'll pass in the student.
Let's save that and give it a try.
I've hitted submit,
and you can see our Newer Student has been added.
I've left line 41 commented in so that you can compare,
and see the trade-off.
In this case we get slightly more code
by adding in the mapMutations,
but then we save some code
when we're committing the mutation.
So once again I'll leave it up to you,
to decide which method you'd like to use.
I'll get rid of line 41,
and save it as is for this demonstration,
and for the exercise files.