My router: url in the url bar changing but the component won't render

Hello everyone;
I am using NavLink to redirect users to the specified route but when i click on the NavItem the url in url bar will change but the view will still remain the same.
When i manually type into the url, the page will reload then take me to the component/view.

Here is my navigation item

import { NavLink } from 'react-router-dom'
...
  <NavLink to="/dashboard/me" className="navbar-content-li">
                    <FontAwesomeIcon icon={faChartPie}/>
                    Dashboard
                </NavLink>
                <NavLink to="/dashboard" className="navbar-content-li">
                    <FontAwesomeIcon icon={faCartPlus}/>
                    Product
                </NavLink>
                <NavLink to="/dashboard" className="navbar-content-li">
                    <FontAwesomeIcon icon={faChartLine}/>
                    Analitics
                </NavLink>
                <NavLink to="/dashboard/ecommerce" className="navbar-content-li">
                    <FontAwesomeIcon icon={faWallet}/>
                    Ecommerce
                </NavLink>
                <NavLink to="/dashboard" className="navbar-content-li">
                    <FontAwesomeIcon icon={faComments}/>
                    Messaging
                </NavLink>
...

the routers

import {BrowserRouter as Router, Switch, Route, withRouter} from "react-router-dom"
....
			<Router >
				<Switch>
          			<Route path="/dashboard/ecommerce" component={withRouter(Ecommerce)}/>
					<Route path="/dashboard/me" component={withRouter(DashboardTop)}/>
					<Route path="/dashboard/myproduct" component={withRouter(Myproducts)}/>
				</Switch>
			</Router>

I need help

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.