I am facing a path issue with react router and laravel. I want to go to this path: /users/create . Its renders fine with react router but when i am in this path and i refresh the page i get a 404 and redirected due to middleware. Why is this happening?
** Note: When i use everywhere users-create instead users/create it works but its not what i want.
Code:
AppRouter.js
<Router history={history}>
<div className="wrapper">
<Sidebar/>
<div className="main-panel">
<Navbar/>
<Switch>
<Route exact path='/dashboard' component={Dashboard} />
<Route exact path='/categories' component={Category} />
<Route exact path='/users/create' component={UserCreate} />
<Route exact path='/users' component={User} />
<Route component={NotFound}/>
</Switch>
<Footer/>
</div>
</div>
</Router>
Routes.php
Route::view('/dashboard', 'main')->middleware('auth', 'preventHistory');
Route::view('/categories', 'main')->middleware('auth', 'preventHistory');
Route::view('/users/create', 'main')->middleware('auth', 'preventHistory');
Route::view('/users', 'main')->middleware('auth', 'preventHistory');
Sidebar.js
<li className="nav-item ">
<NavLink exact to='/users' activeClassName='active'>
<span className="sidebar-normal">y</span>
</NavLink>
</li>
<li className="nav-item ">
<NavLink exact to='/users/create' activeClassName='active'>
<span className="sidebar-normal">x</span>
</NavLink>
</li>