- Build a React component that holds an immutable array as state and updates it
- Fork and clone this repository
npm install
to install dependenciesnpm start
to start the React development server
In this exercise you are provided with a simple component that maintains a list of randomly generated workouts. You must implement the provided function placeholders to make the application functional. To do this, you will need to understand how to manipulate an immutable array held as React state.
- Implement the
addNewWorkout
function to add thenewWorkout
object to theworkouts
state in an immutable way.
- Implement the
deleteWorkout
function to remove theworkout
from theworkouts
state in an immutable way.
- Implement the
completeWorkout
function to set thedone
boolean to true on the passedworkout
and updateworkouts
state in an immutable way.
- Add a checkbox with the label "Show Done Only" to allow the user to toggle between all workouts and only workouts that are done.
- Add a new button to each workout that when clicked replaces the workout with another random workout