Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Render an Element in React | Fundamentals of React and Component-Based UI
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Introduction to React

bookChallenge: Render an Element in React

Note

All challenges may appear broken by default since they contain whitespace sections where you need to input the necessary code. Once you correctly fill in these whitespace sections, the completed code will be displayed on the live page.

Additionally, every challenge features two buttons: Hint and Solution. Clicking on Hint provides small hints for the current challenge, while selecting the Solution button opens a new tab with the completed challenge.

How to work with Code Sandbox

Task: Creating a Product Card

Create the product card and render it to the DOM. The product card needs:

  1. The product image (img element).
    • src attribute must be equal to the imageUrl variable.
    • alt attribute must be equal to the string Computer.
    • width attribute must be equal to the 256.
  2. The product title (h3 element).
    • Its text content must be Computer.
  3. The product price (span element).
    • Its text content must be Price: $129.99.
  4. The product description (p element).
    • Its text content must be New Model.
  1. The src attribute must contain the imageUrl variable as a value. Use curly braces {}.
  2. The alt attribute must contain the string "Computer" as a value. Enclose it in double quotes.
  3. The width attribute must contain the number 256 as a value. Use curly braces {}.
  4. Ensure that the h3span, and p elements have correct values.

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 7

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

Suggested prompts:

Can you explain how to use the Hint and Solution buttons?

What should I do if the live page doesn't render after making changes?

Can you walk me through creating the product card step by step?

bookChallenge: Render an Element in React

Swipe to show menu

Note

All challenges may appear broken by default since they contain whitespace sections where you need to input the necessary code. Once you correctly fill in these whitespace sections, the completed code will be displayed on the live page.

Additionally, every challenge features two buttons: Hint and Solution. Clicking on Hint provides small hints for the current challenge, while selecting the Solution button opens a new tab with the completed challenge.

How to work with Code Sandbox

Task: Creating a Product Card

Create the product card and render it to the DOM. The product card needs:

  1. The product image (img element).
    • src attribute must be equal to the imageUrl variable.
    • alt attribute must be equal to the string Computer.
    • width attribute must be equal to the 256.
  2. The product title (h3 element).
    • Its text content must be Computer.
  3. The product price (span element).
    • Its text content must be Price: $129.99.
  4. The product description (p element).
    • Its text content must be New Model.
  1. The src attribute must contain the imageUrl variable as a value. Use curly braces {}.
  2. The alt attribute must contain the string "Computer" as a value. Enclose it in double quotes.
  3. The width attribute must contain the number 256 as a value. Use curly braces {}.
  4. Ensure that the h3span, and p elements have correct values.

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 7
some-alt