I am serving a react app on springboot. Currently I have react-router set up. When a is clicked in the React app, it is sent to a Spring view controller that looks for the URL and return the "index" template with the react app. React router then has several routes set up. Right now basic routes are working, but I am now trying to send a parameter to the new page. I am able to send the ID to the ViewController but React-router is not able to recognize the path and returns 404. Here's the ViewController.java code.
@RequestMapping(value = {"/book/{id}"})
public String getBook(@PathVariable("id") long id) {
System.out.println("Id is " + id);
return "index";
}
And here's the route I'm trying to direct to, which is in a in root.js.
<Route path="/book/:id" component={Book} />