This course has been updated! We now recommend you take the React Native, v2 course.
Transcript from the "Exercise: Adding an Exercise" Lesson
[00:00:00]
>> [MUSIC]
[00:00:03]
>> Scott: So based on what we have here, so on this ExerciseList, when it renders it's gonna have a list of exercises. I wanna be able to tap on that exercise and have it add the exercise that I tapped on to the current workout array. So you need to make another action that when clicked is gonna add the current exercise.
[00:00:24] So if you go look in the ExerciseList here, the current exercise would be this exercise right here. So you'd probably do like a button or highlight opacity or something like that to be able to on-press. So, on-press, we want to fire off an action that we need to create.
[00:00:41] And we can call that addExercise. And we want that action to add exercise to the current workout. So on our current workout reducer, it's actually already here. ADD_EXERCISE_COMPLETE. And that's because it's gonna be async, but we're gonna do async after we do this. So if you could just make an action, whatever you wanna call it.
[00:01:00] Mine is called ADD_EXERCISE_COMPLETE. And it's just gonna add it to the addExcercise array, just push it in there. And that's it. And that's all you gotta do.