Replies: 2 comments 2 replies
-
I'm very curious about this as well. Rolling our own interpolation is simple enough, but we currently define route paths as constants, which makes the system easier to update if the URL structure changes. Example:
Is this possible with React Location? The tree definition structure does not easily allow extraction of a complete path. I don't like the idea of hard coding paths as strings every time we specify a link or redirect URL. Any recommended approaches for this? |
Beta Was this translation helpful? Give feedback.
-
It would be cool to have a utility to get the link builder generated from routes, eg const navigator = createLinkBuilder(routes);
<Link to={navigator.author.posts.post({
authorId: 123,
postId: 456
}))} |
Beta Was this translation helpful? Give feedback.
-
Coming from react-router I used generatePath a lot to interpolate params in route paths. Is there a react-location counterpart I could use for that task?
Looking through the docs, I could not find a similar function. I found interpolatePath in the code, which seems to be doing exactly what I'm looking for. Unfortunately it's not exported.
Beta Was this translation helpful? Give feedback.
All reactions