Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parent path with param #25

Open
Sexual opened this issue Jul 25, 2018 · 2 comments
Open

Parent path with param #25

Sexual opened this issue Jul 25, 2018 · 2 comments

Comments

@Sexual
Copy link

Sexual commented Jul 25, 2018

Is there a way for the parent path to have a param in it like the example below?

path="/image/:id/comments" parentPath="/image/:id"

Doing this does not work, hence I believe that the parent path logic isn't the same as the one used in react router as when you click the backdrop, it will redirect to /image/:id without the actual ID.

@davidmfoley
Copy link
Owner

Good feature request. In the meantime, there is an undocumented workaround: you can provide a function for parentPath and it will be invoked with the current Match and the result will be used as the parentPath.

@Sexual
Copy link
Author

Sexual commented Jul 26, 2018

@davidmfoley indeed doing something like the below option does work.

parentPath={(match) => `/image/${match.params.id}`}

I'll look into getting a pull request done with a solution for it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants