i'm trying to make multiple pages in react app , and I'm confused how to set my codes properly;I have a component folder which has Navbar.jsx which I have my nav items that i want to send me to another page when i click(react-route) . and I have the Container folder which has Header.jsx and that what i want to change based on the nav items clicked.
import React, { useState } from 'react';
import { RiMenu3Line, RiCloseLine } from 'react-icons/ri';
import './Navbar.css';
import logo from '../../assets/logo.png'
import {
BrowserRouter as Router,
Switch,
Route,
Link,
useRouteMatch,
useParams
} from "react-router-dom";
const Menu = () => (
<>
<Router>
<p><Link to={"/about"}>About</Link></p>
<p><Link to={"/contact"}>Contact</Link></p>
</Router>
</>
)
const Navbar = () => {
...
Header.jsx I didnt change any thing
const Header = () => {
return (...
Via Active questions tagged javascript - Stack Overflow https://ift.tt/2FdjaAW
Comments
Post a Comment