scrimba
Frontend Career Path
Advanced React
React Router
A11y Update - wrapping complex content in a link
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

A11y Update - wrapping complex content in a link
AboutCommentsNotes
A11y Update - wrapping complex content in a link
Expand for more info
pages
Vans.jsx
run
preview
console
import React from "react"
import { Link } from "react-router-dom"

export default function Vans() {
const [vans, setVans] = React.useState([])
React.useEffect(() => {
fetch("/api/vans")
.then(res => res.json())
.then(data => setVans(data.vans))
}, [])

const vanElements = vans.map(van => (
<div key={van.id} className="van-tile">
<Link to={`/vans/${van.id}`}>
<img src={van.imageUrl} />
<div className="van-info">
<h3>{van.name}</h3>
<p>${van.price}<span>/day</span></p>
</div>
<i className={`van-type ${van.type} selected`}>{van.type}</i>
</Link>
</div>
))

return (
<div className="van-list-container">
<h1>Explore our van options</h1>
<div className="van-list">
{vanElements}
</div>
</div>
)
}
Console
/vans/2
-5:48