The erors I am getting are these:
Pretty much non of my routes are working.
Figures… you create a component, import the component to App.js and give it a path, then you have a navbar with a link to that path… so… why wouldn’t it work?
App.js code
import "./App.css";
import React from "react";
import { BrowserRouter, Routes, Route } from "react-router-dom";
import Navbar from "./Component/navbar.component";
import Third from "./Component/third.component";
import Fourth from "./Component/fourth.component";
function App() {
return (
<BrowserRouter>
<div className="App">
<Navbar />
<Routes>
<Route path="/third" component={<Third />} />
<Route path="/fourth" component={<Fourth />} />
</Routes>
</div>
;
</BrowserRouter>
);
}
export default App;
Navbar code:
import React from "react";
import { Link } from "react-router-dom";
function Navbar() {
return (
<nav className="navbar navbar-dark bg-dark navbar-expand-lg">
<Link to="/" className="navbar-brand">
Table List
</Link>
<div className="collapse navbar-collapse">
<ul className="navbar-nav mr-auto">
<li className="navbar-item">
<Link to="/" className="nav-link">
Items
</Link>
</li>
<li className="navbar-item">
<Link to="/third" className="nav-link">
This is Third
</Link>
</li>
<li className="navbar-item">
<Link to="/fourth" className="nav-link">
This is Fourth
</Link>
</li>
</ul>
</div>
</nav>
);
}
export default Navbar;
Other component code:
import React from "react";
import { Link } from "react-router-dom";
function Third() {
return <h1>I am the third component</h1>;
}
export default Third;