This is a collection of tiny apps built with React, designed to explore and learn React along with its associated libraries. Each project serves as a hands-on experiment to try out new features and deepen understanding of the React ecosystem.
JSX is a XML-like syntax extension to ECMAScript (the acronym stands for JavaScript XML). Basically it just provides syntactic sugar for the React.createElement()
function, giving us expressiveness of JavaScript along with HTML like template syntax.
Before React V17, we have to use import React from "react"
in every JavaScript file to use the React.createElement
for creating an elemet.
We are using React.createElement
for creating an elemet, But the code gets bigger and cumberstone when our line of codes increases. For solving the same we are using JSX. From v17 we don’t need to use use import React from "react"
in every JavaScript file.
JSX Method
return (
<div>
<h2>Let's get started!</h2>
<Expenses expenses={expenses}/>
</div>
);
Takes three elements are argument, first one is the element, next is the object of the attribuites of the element and last one is the list of elements inside the main element.
return React.createElement(
'div',{},
React.createElement('h2', {}, "Let's get started!"),
React.createElement(Expenses, { expenses: expenses})
)
Restrictions in JSX
class
keyword cannot be used.- React is converting the JSX in the backend.
- Wrap element in a single root.
What are your thoughts on this post?
I’d love to hear from you! Click this link to email me—I reply to every message!
Also use the share button below if you liked this post. It makes me smile, when I see it.