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

Dynamic segments called "key" are silently removed #447

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

polarblau
Copy link

If a dynamic segment is called “key” it will be silently removed from the props.

/some-path/:foo/bar/:key — would include foo in the props passed to the child component but not key.

The docs state:

Reserved Names: You can name your parameters anything want except uri and path. You’ll get a warning if you try, so don’t worry if you didn’t actually read these docs (… 🤔).

I’m assuming that this issue happens due to a clash with React? However, a dynamic segment called e.g. className seems to be passed fine.

My suggestion would be to either find a way to pass the parameter as any other or include a note in the documentation. key might be a more common parameter name than others.

Attached is a failing test. Additionally — and maybe easier — you can see the issue here: https://codesandbox.io/s/mystifying-golick-fchxm?file=/src/App.js

@polarblau polarblau changed the title Adding test for dynamic segment called key. Dynamic segments called "key" are silently removed Jan 10, 2021
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

Successfully merging this pull request may close these issues.

1 participant