🖨 Print / Save PDF
← Lesson
BitWith
Bite
React · Quick Reference
Lesson 4 — Components & Props
Cheat Sheet
React
In one line:
Props pass data one-way from parent to child; callbacks let the child notify the parent instead of modifying props directly.
Key Ideas
1
Props.
Passed as attributes, read-only.
2
Destructuring.
({ title, lessons, free })
3
Conditional.
{cond && <X/>} or {cond ? A : B}
4
Callback props.
onEnroll={(id)=>handleEnroll(id)}
Example
function CourseCard({title, free, onEnroll}) { return <div> <h2>{title}</h2> {free && <span>FREE</span>} <button onClick={()=>onEnroll(title)}>Enroll</button> </div>; }