what is jsx

 JSX allows us to write HTML in React.

JSX makes it easier to write and add HTML in React.


two ways to create html

directly and inderectly

with jsx

import React from 'react';
import ReactDOM from 'react-dom/client';

const myElement = React.createElement('h1', {}, 'I do not use JSX!');

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(myElement);


=

without jsx

import React from 'react';
import ReactDOM from 'react-dom/client';

const myElement = React.createElement('h1', {}, 'I do not use JSX!');

const root = ReactDOM.createRoot(document.getElementById('root'));
root.render(myElement);


==


we can evaluate expression using {}

const myElement = <h1>React is {5 + 5} times better with JSX</h1>;

No comments:

Post a Comment

create cartoon video using ai

  https://www.piclumen.com/ using this we can crate cartoon photos https://hailuoai.video/ its not free upto 1000 points we canuse it for fr...