Props သည် parent component က child component ဆီ data ပေးပို့တဲ့နည်းလမ်းပါ။ Component တစ်ခုကို template လိုရေးထားပြီး props အမျိုးမျိုးပေးလိုက်ရင် card title, price, image, button text စတာတွေကို လွယ်လွယ်ပြောင်းနိုင်ပါတယ်။
jsx
function CourseCard({ title, level, lessons }) {
return (
<article className="course-card">
<h2>{title}</h2>
<p>Level: {level}</p>
<p>{lessons} lessons included</p>
</article>
);
}
function App() {
return (
<CourseCard
title="React Foundation"
level="Starter"
lessons={18}
/>
);
}`CourseCard` က `title`, `level`, `lessons` ဆိုတဲ့ props သုံးခုကိုလက်ခံပါတယ်။ Parent ဖြစ်တဲ့ `App` က တန်ဖိုးတွေကို attribute ပုံစံနဲ့ပေးထားပါတယ်။
You should see
Course title, level, lessons count ပါတဲ့ card တစ်ခု ပေါ်လာမယ်။Info
String props ကို quote နဲ့ပေးပြီး number, boolean, object, array props တွေကို `{}` ထဲမှာပေးပါတယ်။