JSX ထဲတွင် tag ကို return ပြန်ရန်အတွက် သတ်မှတ်ချက်များ
return မှတစ်ဆင့် tag ပါရှိသည့်
variable ကို return ပြန်နိုင်ပါသည်။
function App() {
let text;
const show = true;
if (show) {
text = <p>text1</p>;
} else {
text = <p>text2</p>;
}
return text;
}
isAdmin ဆိုသည့် constant ထဲတွင်
အသုံးပြုသူသည် admin ဖြစ်ပါက true၊
မဟုတ်ပါက false ပါရှိသည်ဆိုပါစို့။
function App() {
const isAdmin = true;
}
isAdmin ၏ တန်ဖိုးသည် true
ဖြစ်ပါက စာပိုဒ်များပါသည့် div တစ်ခုကို
မျက်နှာပြင်ပေါ်တွင် ပြသပါ။ မဟုတ်ပါက
�ာမှ ပြသစရာမလိုပါ။