Lesson 2 of 10
JSX & Components
JSX is a syntax extension that looks like HTML inside JavaScript. It makes React code easier to read and write. A component is a function that returns JSX. Components are reusable building blocks.
Component names must start with a capital letter. You can nest components inside other components.
REACT
// A simple component
function Welcome() {
return <h2>Welcome to my app!</h2>;
}
// Using the component inside another
function App() {
return (
<div>
<h1>My Website</h1>
<Welcome />
<Welcome />
</div>
);
}