This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Navbar from '../components/navbar/navbar' | |
import { Switch, Route } from "react-router-dom"; | |
import Home from '../components/home/home' | |
import Contact from '../components/contact/contact' | |
import About from '../components/about/about' | |
import Profile from '../components/user/profile' | |
function Main() { | |
return ( | |
<div> | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import './index.css'; | |
import App from './App'; | |
import reportWebVitals from './reportWebVitals'; | |
import { BrowserRouter } from "react-router-dom"; | |
ReactDOM.render( | |
<React.StrictMode> | |
<BrowserRouter> | |
<App /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Navbar from '../components/navbar/navbar' | |
import { HashRouter, Switch, Route } from "react-router-dom"; | |
import Home from '../components/home/home' | |
import Contact from '../components/contact/contact' | |
import About from '../components/about/about' | |
import Profile from '../components/user/profile' | |
function Main() { | |
return ( | |
<div> | |
<HashRouter> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useParams } from "react-router"; | |
function Profile() { | |
// Use the useParams hook to get the username from the URL | |
// username has to be applied as a named parameter in the route | |
const { username } = useParams(); | |
return ( | |
<h1>{username} Profile</h1> | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.active { | |
color: #ffffff; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Navbar from '../components/navbar/navbar' | |
import { BrowserRouter, HashRouter, Switch, Route } from "react-router-dom"; | |
import Home from '../components/home/home' | |
import Contact from '../components/contact/contact' | |
import About from '../components/about/about' | |
function Main() { | |
return ( | |
<div> | |
<HashRouter> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { HashRouter, Switch, Route } from "react-router-dom"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function About() { | |
return ( | |
<h1>About</h1> | |
) | |
} | |
export default About; |