I am having trouble in changing the page in react with react-router-dom. here is my router :-
import { Route, Switch, BrowserRouter } from 'react-router-dom';
import HomePage from '../pages/grocery';
import Profile from '../pages/profile';
import CheckoutPage from '../pages/checkout';
export default function Routes(props) {
return (
<BrowserRouter>
<Switch>
<Route path="/" name="Home" component={HomePage} exact />
<Route path="/profile" name="Profile" component={Profile} />
<Route path="/checkout" name="Checkout" component={CheckoutPage} />
</Switch>
</BrowserRouter>
);
}
and here is my Link tag
<Link to="/profile">Profile</Link>