react route path is not working
it shows only product component in all URL
I Have instilled react-router-dom, and also import BrowserRouter as Router, Switch, Route, Link
What is the problem? I can not figure it out.
import React from 'react';
import Navbar from './component/Navbar/Navbar';
import Product from './component/Product/Product';
import {BrowserRouter as Router,Switch,Route,Link} from "react-router-dom";
import UpComing from './component/UpComing/UpComing';
import NotFound from './component/NotFound/NotFound';
import OrderReview from './component/OrderReview/OrderReview';
function App() {
return (
<div className="App">
<Navbar></Navbar>
<Router>
<Switch>
<Route to="/product">
<Product></Product>
</Route>
<Route to="/OrderReview">
<OrderReview></OrderReview>
</Route>
<Route exact to="/">
<Product></Product>
</Route>
<Route to="*">
<NotFound></NotFound>
</Route>
</Switch>
</Router>
</div>
);
}
export default App;
path
property ofRoute
, not theto
. – Ajeet Shah