Closed JakeHaitsma closed 1 year ago
Hello and thanks for using the library!
If I understood your use case correctly, you need to use either ROUTES.USERS.LIST.buildUrl({})
, which will print "/users"
, or ROUTES.USERS.LIST.buildRelativeUrl({})
, which will print "users"
. The buildUrl
and buildRelativeUrl
functions are intended to be used to produce actual paths for navigation (for instance, they can be used in <Link/>
components).
In contrast, path
and relativePath
are path patterns. For instance, they can be used in <Route/>
components.
If you specifically want a trailing slash (as in "users/"
) - no, that's not supported, because trailing slashes don't do anything in React Router (though you can add it like this: `${ROUTES.USERS.LIST.buildRelativeUrl({})}/`
). If that's the case, can you please explain why you need this?
Please let me know if I misunderstood something.
Hello,
Thanks for your work on this, I believe it can really help my current project. My organization uses sub-routers to add shared wrappers/organize code specific to a particular kind of entity.
For example:
UserRouter
would render the following:ROUTES
would look something like this:How would one navigate to
ROUTES.USERS.LIST.path
while excluding the indeterminate star introduced byUSERS
route
? Does this project support that?relativePath
omits it, as noted in the README, but I'm curious if this use case is supported.