React Router: Handling international routes


Hey guys,
I’m just wondering how you handle international routes on React Router. I have the following route structure:

<Router path="/(:langCode)">
  <Route path="about"/>
  <Route path="order"/>

I’m just wondering how I could easily link to these routes within a menu? Normally, I would create a Link component like this:

<Link to="/about"/>

But this would create a wrong url if I’m on, because I’m linking to the root url and get redirected to instead of


You could wrap the <Link /> component in your own component.

function LocalizedLink(props) {
  let link = "/" + props.params.langCode + "/" +;
  return (
    <Link path={link} />

then call it with:

<LocalizedLink to="/about" />

May not be fully correct as I didn’t test it but you should get the idea.


Yeah, just thought about the same one. So I can access the Routers context and look for the langCode parameter. I’m just wondering why React Router doesn’t support it in the core.