scrimba
Advanced React
React Router
Note from the future: importing image assets in Vite
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

Note from the future: importing image assets in Vite
AboutCommentsNotes
Note from the future: importing image assets in Vite
Expand for more info
components
Header.jsx
run
preview
console
import React from "react"
import { Link, NavLink } from "react-router-dom"

export default function Header() {
const activeStyles = {
fontWeight: "bold",
textDecoration: "underline",
color: "#161616"
}

return (
<header>
<Link className="site-logo" to="/">#VanLife</Link>
<nav>
<NavLink
to="host"
style={({isActive}) => isActive ? activeStyles : null}
>
Host
</NavLink>
<NavLink
to="about"
style={({isActive}) => isActive ? activeStyles : null}
>
About
</NavLink>
<NavLink
to="vans"
style={({isActive}) => isActive ? activeStyles : null}
>
Vans
</NavLink>
<Link to="login" className="login-link">
<img
src="../assets/images/avatar-icon.png"
className="login-icon"
/>
</Link>
</nav>
</header>
)
}
Console
/host
-2:47