1

I found a similar SO Post and this unanswered post, however, what do you do when you need a dynamic path (path parameter)?

Like /calendar/:year/:month/:day/event where it could be, for example, /calendar/11/4/21/event

Jeremy
  • 1,717
  • 5
  • 30
  • 49
  • edit: wait! --- reread question.... checking ~exactly how you've written it https://reacttraining.com/react-router/web/example/url-params~ – azium Dec 15 '17 at 22:07
  • actually I don't think I totally understand your question. you want dynamic paths, but also using a basename? – azium Dec 15 '17 at 22:09

1 Answers1

2

The basename that you can pass to a router (e.g. <BrowserRouter basename='/thing'>) is not dynamic. You should think of the basename as the static path to the root directory where your app is located (although this might not be a literal path since you're most likely using a dynamic server).

Occasionally I have seen requests for dynamic basenames, usually when someone has language sections of their site (example.com/en/about and example.com/zh/about). The usual reason for wanting to include this information in the basename is so that it doesn't have to be included in URIs. However, the basename isn't supposed to contain information about the route; any data that isn't going to be the same for every single route in your application should not be part of the basename.

Paul S
  • 35,097
  • 6
  • 41
  • 38