Challenge: Render an Element in React
Swipe to show menu
Note
All challenges may appear incomplete by default. They include empty sections where you need to add the required code. Once all missing parts are filled in correctly, the completed code will be rendered on the live page.
Each challenge includes two helper buttons:
- Hint: shows small clues to guide you;
- Solution: opens the completed version in a new tab.
You can also watch the short video tutorial below to learn how to work with CodeSandbox.
How to work with Code Sandbox
Task: Creating a Product Card
Create a simple product card using JSX and render it to the DOM. The product card must include:
- The product image (
imgelement).srcattribute must be equal to theimageUrlvariable.altattribute must be equal to the stringComputer.widthattribute must be equal to the256.
- The product title (
h3element).- Its text content must be
Computer.
- Its text content must be
- The product price (
spanelement).- Its text content must be
Price: $129.99.
- Its text content must be
- The product description (
pelement).- Its text content must be
New Model.
- Its text content must be
- Theย
srcย attribute must contain theยimageUrlย variable as a value. Use curly bracesย{}. - Theย
altย attribute must contain the stringย"Computer"ย as a value. Enclose it in double quotes. - Theย
widthย attribute must contain the numberย256ย as a value. Use curly bracesย{}. - Ensure that theย
h3,ยspan, andยpย elements have correct values.
Everything was clear?
Thanks for your feedback!
Sectionย 1. Chapterย 5
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Sectionย 1. Chapterย 5