-
ReactDOM.createRootis a method introduced in React 18 that enables the new Concurrent Mode, allowing React to work more efficiently and prepare for future features like selective rendering and transitions.rendertakes only one HTML element. Therefore for multiple components, it’s easier to combine a couple things into a<div>which treats the whole thing as a single div.
-
JSX is essentially a JS file. Through node we are injecting HTML. So we can further inject JS code into that HTML as well
- The JS is inserted into the HTML using curly braces
{}
- The JS is inserted into the HTML using curly braces
-
In JSX, you can write JavaScript expressions (like
2 + 2,user.name, orternaries), but not full statements (like if, for, while, etc.). -
Template literals are also supported.
const greeting = `Hello, my name is ${name} and I am ${age} years old.`;- Script type in HTML file should be
JSXinstead of the usual javascript - The CSS class name is usually
class="cname"but for JSX it isclassName = "cname" - The class names are the same as HTML global ones, but in Camel case. For example,
contenteditablein HTML becomescontentEditablein JSX.