JSX Syntax Rules in React
📖 Scenario: You are building a simple React component that displays a greeting message and a list of your favorite fruits. You will learn how to write JSX correctly, including how to use expressions, attributes, and proper syntax.
🎯 Goal: Create a React functional component named FavoriteFruits that renders a heading and an unordered list of fruits using correct JSX syntax.
📋 What You'll Learn
Create a functional component named
FavoriteFruitsUse JSX to render a
<div> containerInside the container, add a
<h1> with the text 'My Favorite Fruits'Create an array of fruits inside the component
Render the fruits as an unordered list (
<ul>) with each fruit as a list item (<li>)Use correct JSX syntax for expressions and attributes
💡 Why This Matters
🌍 Real World
React components with JSX are the building blocks of modern web apps. Knowing JSX syntax helps you create interactive and dynamic user interfaces.
💼 Career
React is widely used in web development jobs. Understanding JSX syntax rules is essential for writing clean, maintainable React code.
Progress0 / 4 steps