Skip to the content.
Part 6. react-router-dom 2/2
Router Links
- Create new folder
./src/components/navbar
- Inside the navbar folder, create component and style file for it
navbar.tsx
, navbar.module.scss
- Initialize your navbar component with
fcr
snippet and import the style file in it.
- In the navbar.module.scss, create a new style class
.container
and call it inside of your navbar.tsx start div tag to use it as an attribute. (See Part-2. Add Dart sass to project)
- Between the div tags, add three Link components, and for each link give
to
attribute to point your links to the /
, first
and example
pages
<Link to="/">Home</Link>
<Link to="/first">My First Component</Link>
- In the index file, set your Navbar component between the BrowserRouter and Router elements.