scrimba
Advanced React
React Router
Route Params part 3.2 - useParams() challenge
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

Route Params part 3.2 - useParams() challenge
AboutCommentsNotes
Route Params part 3.2 - useParams() challenge
Expand for more info
pages
VanDetail.jsx
run
preview
console
import React from "react"
import { useParams } from "react-router-dom"
export default function VanDetail() {
const params = useParams()
console.log(params)
/**
* Challenge part 2:
* Using the endpoint set up (with mirage js), fetch the data
* for the van with the current ID from params.id. Log the data
* that comes back to the console.
*
* Hint: the endpoint is a GET request to `/api/vans/:vanid`
*/
return <h1>Van detail page goes here</h1>
}
Console
{id:
"2"
}
,
/vans/2
-7:10