Optional Url Params
See original GitHub issueHi,
Love the project; thanks,
I have a problem with a path with an optional parameter.
When navigating to /sensor/register
the breadcrumb shows:
Register Sensor
but navigating to /sensor/register/123
results in:
Register Sensor / Register Sensor
I have the following path setup in my routes.config - the offending route is at the bottom…
const routesConfig = [
{
path: '/hubs',
exact: true,
component: MyHubsContainer,
breadcrumb: 'My Hubs'
},
{
path: '/hubs/register',
exact: true,
component: RegisterHubContainer,
breadcrumb: 'Register Hub'
},
{
path: '/hubs/:hubId',
exact: true,
component: HubDashboardContainer,
breadcrumb: HubBreadcrumbItem
},
{
path: '/hubs/:hubId/sensor/:sensorId/:sensorName',
exact: true,
component: SensorDetailContainer,
breadcrumb: SensorBreadcrumbItem
},
{
path: '/sensor/instructions',
exact: true,
component: InstructionsContainer
},
{
path: '/sensor/register/:hubId?',
exact: true,
component: RegisterSensorContainer,
breadcrumb: 'Register Sensor'
}
]
const MainRoutes = (props) =>
<Switch>
{routesConfig.map((route, i) =>
<Route
exact={route.exact}
key={route.path}
path={route.path}
component={route.component}
/>)}
</Switch>
const Breadcrumbs = ({ breadcrumbs }) =>
<div>
{breadcrumbs.map((breadcrumb, index) => (
<Link key={breadcrumb.key} to={breadcrumb.props.match.url || ''}>
{breadcrumb} {console.log('breadcrumb', breadcrumbs.length, breadcrumb)}
</Link>
))}
</div>
Any ideas?
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Using Optional Parameters | FastSpring Classic Documentation
Sometimes you may want customers to see a specific state or version of your store. One common way to accomplish this is to...
Read more >Optional URL Parameters - Mapp documentation
Optional URL Parameters. In Mapp Intelligence, it is possible to send a variety of additional pre-defined or custom parameters.
Read more >How to access optional URL parameters in Express.js?
You have multiple consecutive optional parameters in your URL. When you hit localhost:3000/show/luis/California/123, express had no way of ...
Read more >Passing Optional Parameters to a Route - Rangle.io
Query parameters allow you to pass optional parameters to a route such as pagination information. ... The key difference between query parameters and...
Read more >React Router: Optional Parameters - DigitalOcean
The route will be rendered if it matches the path, with or without the optional parameter. So '/Lyrics/Spoonman' and '/Lyrics/Spoonman/3' would ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey @luke-unifymonitor this key warning is fixed in
2.1.4
. Here is the updated code sandbox: https://codesandbox.io/s/13j7vr75yl🤔 I should fix that warning. I’ll look into this case in the near future.
Thanks for the reply and the code sandbox @luke-unifymonitor !