'React Router with Params giving 404 error

Below are the routes in my project

   <Route exact path="/admin-users" component={User}/>
   <Route exact path="/admin-events" component={Events}/>
   <Route exact path="/admin-createEvent" component={CreateEvent}/>
   <Route exact path="/admin/:id" component={Home}/>
   <Route exact path="/xx/:id" component={Home}/>

Iam able to go on regular routes like '/admin-users' but not when they have params in it like '/xx/1'. It gives 404 error.

I have in my index.php I have tried replacing my node_modules with another project that is working just fine. I have tried downgrading my react version.

Still the error persists.

Any help?

Thanks in advance



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source