scrimba
Learn React Router
Nested Routes
Bootstrap the Host pages
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

Bootstrap the Host pages
AboutCommentsNotes
Bootstrap the Host pages
Expand for more info
index.jsx
run
preview
console
import React from 'react';
import ReactDOM from 'react-dom/client';
import { BrowserRouter, Routes, Route, Link } from "react-router-dom"
import Home from "./pages/Home"
import About from "./pages/About"
import Vans from "./pages/Vans/Vans"
import VanDetail from "./pages/Vans/VanDetail"
import Layout from "./components/Layout"

import "./server"

/**
* Challenge:
* 1. Add a "Host" link to the Navbar that takes you to the "/host" path
* 2. Create the following components in the pages/Host folder:
* a. Dashboard ("/host")
* b. Income ("/host/income")
* c. Reviews ("/host/reviews")
* These components can just have an h1 for now that says, e.g.
* "Host Dashboard here".
* 3. Set up routes for each of these pages in the Routes below. FOR NOW,
* don't worry about nesting anything, you can just put them on the same
* level as the "/vans", etc. routes below.
*/

function App() {
return (
<BrowserRouter>
<Routes>
<Route element={<Layout />}>
<Route path="/" element={<Home />} />
<Route path="/about" element={<About />} />
<Route path="/vans" element={<Vans />} />
<Route path="/vans/:id" element={<VanDetail />} />
</Route>
</Routes>
</BrowserRouter>
)
}

ReactDOM
.createRoot(document.getElementById('root'))
.render(<App />);
Console
/
-3:57