I'm trying to create an app where users can join groups, and one of the pages I have is a group dashboard. For this, I created a route with a URL parameter of id.
<Router>
<div>
<LoggedRoute exact path = "/" component = {Home}/>
<Route exact path = "/login" component = {Login}/>
<Route exact path = "/groups/:id" component = {GroupDash}/>
</div>
</Router>
When a user creates a group, it persists it in my database, and gets the docID to use as the url parameter.
I then use history.push("/groups/".concat(docID))
to attempt to re-direct my user to the new page. However, this doesn't work and instead takes me to .../groups/
vs .../groups/docID
.
I initially thought that this was because the string, docID
wasn't being created properly, but after logging the string to the console, it is correct.
Can someone help me with this?