I am working on react LMS Enrolled Should send true or false. Based on if the user has already enrolled in that course. How to execute CheckifEnrolled function upon sending it to child.
<CourseCard
Enrolled={()=>CheckIfEnrolled(Course.courseid)?true:false}
Course={Course}
UserInfoFromDB={props.UserInfoFromDB}
isSignedIn={props.isSignedIn}
/>```
Instead of passing
()=>CheckIfEnrolled(Course.courseid)?true:false
that is an arrow function that when will be triggered will return some bool, pass
CheckIfEnrolled(Course.courseid)?true:false
now you are passing the bool itself accord the result of CheckIfEnrolled