I have a project that uses React in frontend and Django as backend.
Also I use react router in my project and the code looks like this:
<BrowserRouter>
<Switch>
<Route path="/" exact component={Home} />
<Route path="/teachers" exact component={Teachers} />
<Route path="/courses" exact component={Courses}/>
<Route path="/about" exact component={About} />
<Route path="/posts" exact component={Posts} />
</Switch>
</BrowserRouter>
In django my urls file looks like this:
urlpatterns = [
path('', views.index, name="index"),
]
The problem is that whenever I try to navigate to the page from react router I get 404 error from django.