ReactJS


JSX

const element=(
    <div>
        <h1>Hello world</h1>  
        <p>This my work</p>  
    </div>);

document.write(element);

JavaScriptda HTML taglar yozish bu JSX. Bu oddiy JavaScriptni õzida emas balki maxsus React proekt hosil qilinib, shu proektda ishlatiladi. JavaScriptda bu codlar ishlamaydi.
const upper=name=>name.toUpperCase(); 
const element=(
<h1>
  Hello, {'User'+upper('dalavoy')}
</h1>)

JSXda, elementga konteyner birlashtirish
const element=<p className="p" onClick="Hello">
JSXda HTML taglarga atribut qõshish
⚠Artibutlarning 2-harfi doim bosh harf bilan boshlanishi kerak.
const url="img/imgOne.jpg";
const img=(
     <img src={url} width="300" height={500}/>
)

JSXda HTML artibutlarga qiymatlarni 2 xil usulda berish mumkin. { }, yoki " " bilan.