Optional parameter route
Hi there! I'm curious about implementing an optional parameter route. Specifically, I'm wondering if it's feasible to manage variations like
workspace and workspace/${id} using a single component without registering two separate routes.1 Reply
fair-rose•2y ago
If you need to display content on the
/workspace path, then you'd need a route configuration for that.
If you need to display content on the /workspace/$workspaceId path, then you'd need a route configuration for that.
You can choose to use the same component on both routes, but I'd honestly, break apart the components that are common between both pages and compose them as needed for those routes. Shared behaviour can easily be handled by passing in callbacks as props.