Loading Depth Study
Preparing your workspace
JSX is a syntax extension that allows developers to describe UI using HTML-like syntax inside JavaScript code.
JSX makes React component code easier to read because markup and JavaScript logic can be expressed together. JSX looks similar to HTML but follows JavaScript rules. Expressions can be placed inside curly braces. Attributes use names such as className instead of class, and event handlers use JavaScript-style names such as onClick. A component must return a single parent structure or a Fragment. JSX is transformed into JavaScript before the browser runs it.
A course card can use JSX to display a course name and progress value directly from component data.
function CourseCard() {
const course = 'React';
const progress = 75;
return (
<article>
<h2>{course}</h2>
<p>Progress: {progress}%</p>
</article>
);
}The page displays 'React' as the heading and 'Progress: 75%' below it.