Objective:
- Learn how to create and export functional components in React.
- Understand how to pass data through props, destructure props, and set default props with propTypes.
- Exercise 1: Create a Simple Functional Component
- Create a new component called
Greeting.jsx
that displays a greeting message like "Welcome to React!".
- Use a default export for this component.
- Exercise 2: Import and Use the Component
- In
App.jsx
, import the Greeting
component and render it within the App
component.
- Verify that the greeting message appears on the page.
- Exercise 3: Create Another Component
- Create another functional component called
UserInfo.jsx
that displays your name, age, and a short bio.
- Use a default export for this component.
- Exercise 4: Import and Use the New Component
- Import and use the
UserInfo
component inside App.jsx
.
- Ensure that both
Greeting
and UserInfo
components are displayed together on the page.