Contenido del Curso
React Mastery
React Mastery
1. Fundamentals of React and Component-Based UI
What Is React and Why Use It?Comparing SPAs and MPAs in Web DevelopmentHow React Works with the Virtual DOMIntroducing JSX for Writing HTML in JavaScriptBuilding Complex UI with JSX Rendering Elements in ReactChallenge: Render an Element in ReactUnderstanding React ComponentsPassing Data with Props in ReactChallenge: Create Functional ComponentsConditional Rendering in ReactChallenge: Implement Conditional Rendering – Chat NotificationChallenge: Implement Conditional Rendering – Bank AlertRendering Collections of Data in ReactChallenge: Display Data Collections in ReactReact Fundamentals Wrap-Up
2. Styling Techniques in React Applications
Introduction to Styling in ReactUsing Inline Styles in ReactApplying Inline Styles in PracticeChallenge: Use Inline Styles in a React ComponentStyling React Components with External CSSApplying External CSS in PracticeChallenge: Apply External CSS to a React AppUsing CSS Modules for Scoped Styling in React Organizing File and Folder Structures for StylesChallenge: Use CSS Modules in React Styling Techniques in React Wrap-Up
3. React Hooks and Context for State Management
Introduction to React Hooks and ContextManaging State with the useState HookChallenge: Toggle Visibility with useStateWorking with References Using the useRef HookChallenge: Build a Controlled Form ComponentHandling Side Effects with the useEffect HookChallenge: Fetch and Display Data with useEffectOptimizing Performance with the useMemo HookChallenge: Implement a Car List Filter with useMemoSharing State Across Components with ContextUsing Context in a Real-World ScenarioChallenge: Build a World of Astronomy App with ContextReact Hooks and Context Wrap-Up
Challenge: Create Functional Components
Task: Creating an Encyclopedia Source
In this task, you will create an encyclopedia source of two cards. Each card will display an image and a description. The goal is to practice creating functional components and passing data to child components using props.
Instructions:
- Create a
Card
component as a reusable card template. - In the
Card
component, accept the following props:link
: The URL of the image for the card;alt
: The alternative text for the image;description
: The description text for the card.
- Use the
Card
component twice in theApp
component to create two cards with the following content:
Card 1 (About the Sun):
- Image URL:
https://codefinity-content-media.s3.eu-west-1.amazonaws.com/code-1/react/introduction-to-react/sun.png
- Alternative text: Provide an appropriate description.
- Description: "The sun shone brightly, casting a warm glow across the tranquil beach."
Card 2 (About the Mountain):
- Image URL:
https://codefinity-content-media.s3.eu-west-1.amazonaws.com/code-1/react/introduction-to-react/mountain.png
- Alternative text: Provide an appropriate description.
- Description: "The hiker gazed in awe at the majestic mountain towering before them."
Ensure that both the Card
and App
components are appropriately modified to display the cards correctly.
Here's a starter code with placeholders for you to complete:
- You can use the same
Card
component for both cards and control their content using props. - To pass the URL as a prop, create a prop called
link
and provide the URL as its value. Enclose the value in double quotes since it's a string. - Similarly, create props for
alt
anddescription
and provide the appropriate values. - To use these props within the child component
Card
, access them using dot notation sinceprops
is an object.
¿Todo estuvo claro?
¡Gracias por tus comentarios!
Sección 1. Capítulo 10