11.implement bodypart/category funcitnality
.
in exerxises.jsx file :Add
.We have prop drilled and setbodypart to an item such as waist ,legs ,etc on clicking on a category/bodypart card.
so console.log(bodyPart) to check if it is changing when clicked on particular bodyPart card eg:if i click on waist card then it should console waist.
Now, we need to fetch exercise on basis of that bodypart,so set dependncy of useEffect to bodypart e,each time we click on a bodypart card it changes and useeffect fetch new exercises
.if bodyPart = 'all',(whcih it actually is initially before clicking any card) then fetch all exercises.
);.
..if bodyPart = 'something else',(which it changes when clicking any card) then fetch that exercises for only that particular bodypart.
. else {
.Then set exerxies to that newly fetched data so that UI display thoses exercises:
setExercises(exercisesData);
Comments
Post a Comment