Nested elements in React
Component with a Nested Element in React
React components can include nested elements like buttons, headers, or custom tags. Here’s a simple example:
function Btn() {
const text = "log in";
return <button>{text}</button>;
}
Key Points ^-^
text
is a JavaScript variable.
It’s embedded in JSX using {}
.
The JSX returns a <button>
with dynamic content.
This is a minimal example of using nested elements and variables inside a component.