Instead of manually mutating the DOM with imperative commands (document.getElementById), React lets you declare what the UI should look like for a given state. JSX allows writing HTML-like markup directly inside JavaScript, which the compiler compiles into React.createElement() calls.
Entity state & role in architecture: Component State / Props
// A standard functional React component
function FeatureCard({ title, description, badge }) {
return (
<div className="card" style={{ padding: "16px", background: "#1e293b", borderRadius: "8px", color: "white" }}>
<span style={{ background: "#0284c7", padding: "4px 8px", borderRadius: "4px", fontSize: "12px" }}>
{badge}
</span>
<h3 style={{ margin: "8px 0", color: "#38bdf8" }}>{title}</h3>
<p style={{ margin: 0, color: "#94a3b8" }}>{description}</p>
</div>
);
}
// App renders component with custom props
export default function App() {
return <FeatureCard badge="Fast" title="Server Components" description="Zero bundle size on client!" />;
}function FeatureCard({ title, ... })Functional component destructuring incoming props.
className='card'JSX uses className instead of class because class is a reserved word in JS.
{badge}Curly braces allow embedding any JavaScript expression directly into the markup.