scrimba
Learn React
AirBnb clone
React Section 2 Recap
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

React Section 2 Recap
AboutCommentsNotes
React Section 2 Recap
Expand for more info
components
Card.js
run
preview
console
import React from "react"

export default function Card(props) {
let badgeText
if (props.openSpots === 0) {
badgeText = "SOLD OUT"
} else if (props.location === "Online") {
badgeText = "ONLINE"
}

return (
<div className="card">
{
badgeText &&
<div className="card--badge">{badgeText}</div>
}
<img
src={`../images/${props.coverImg}`}
className="card--image"
/>
<div className="card--stats">
<img src="../images/star.png" className="card--star" />
<span>{props.stats.rating}</span>
<span className="gray">({props.stats.reviewCount}) • </span>
<span className="gray">{props.location}</span>
</div>
<p className="card--title">{props.title}</p>
<p className="card--price">
<span className="bold">From ${props.price}</span> / person
</p>
</div>
)
}
Console
/index.html
-1:42