ကိန်းရှင်တန်ဖိုးများ ထည့်သွင်းရာတွင် သတိပြုရမည့်အချက်များ
tag တစ်ခုအတွင်း constant တစ်ခုထည့်သွင်းခြင်းအပြင် အခြားစာသားများလည်း ပါဝင်နိုင်ပါသည်။
function App() {
const str = 'text';
return <div>
eee {str} bbb
</div>;
}
tag တစ်ခုအတွင်းသို့ constant မည်မျှပင် ထည့်သွင်းနိုင်ပါသည်။
function App() {
const str1 = 'text1';
const str2 = 'text2';
return <div>
{str1} {str2}
</div>;
}
Constant များ ထည့်သွင်းခြင်းကို မည်သည့်စာသားဖြင့်မဆို ခွဲခြားနိုင်ပါသည်။
function App() {
const str1 = 'text1';
const str2 = 'text2';
return <div>
{str1} eee {str2}
</div>;
}
အောက်ပါကုဒ်ကို ပေးထားသည်။
function App() {
const name = 'user';
const age = '30';
return <div>
name: ?
age: ?
</div>;
}
ပထမ ? နေရာတွင် အမည်ပါသော constant ကို ထည့်သွင်းပါ။
ဒုတိယအကြိမ်တွင် အသက်ပါသော constant ကို ထည့်သွင်းပါ။