React Router 4.0.0 comes with Regex to validate the querystring parameters. However, it does not seem compatible with ES6 Template Literals.
Here is a very simple example :
<BrowserRouter>
<Switch>
<Route Route path={routeConstant} component={MyComponent} />
</Switch>
</BrowserRouter>
If you try with the following values, you'll see that the first 2 constants work, but the third does not.
const root = 'folder'
const routeConstant1 = '/folder/:id(\d+)' // <= /folder/21 matches
const routeConstant2 = `/${root}/:id` // <= /folder/21 matches
const routeConstant3 = `/${root}/:id(\d+)` // <= /folder/21 does not match
There is probably a very good explanation (there always is), but I'd really appreciate a few pointers because that feels a bit confusing. Thanks in advance.