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

[Bug]: Wrong proptype for from in Redirect component #8136

Closed
Axnyff opened this issue Oct 15, 2021 · 2 comments
Closed

[Bug]: Wrong proptype for from in Redirect component #8136

Axnyff opened this issue Oct 15, 2021 · 2 comments

Comments

@Axnyff
Copy link

Axnyff commented Oct 15, 2021

What version of React Router are you using?

5.3.0

Steps to Reproduce

https://codesandbox.io/s/react-router-v5-forked-pqsli if we use an array of string as the from prop we have a warning that the propTypes is wrong. However, the code looks like it's working fine.

I've checked inside the code how computedMatch is calculated and it looks like an array won't cause any problems to it.

Expected Behavior

There should'nt be any warning if we give the component an array of string.

Actual Behavior

There is a warning if we supply an array of string.

Thanks for your help, I can write a fix for this if we agree this is an issue

@timdorr
Copy link
Member

timdorr commented Oct 15, 2021

While it's supported by the underlying matching library (path-to-regexp), we don't support this in our propTypes. It hasn't worked in prior versions and won't work in v6. It's a "secret" feature that you shouldn't rely on. Instead, just use multiple Redirects.

@timdorr timdorr closed this as completed Oct 15, 2021
@Axnyff
Copy link
Author

Axnyff commented Oct 15, 2021

Ok, thanks for the answer!

have a great day

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