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

Failed prop type: Invalid prop 'component' supplied to 'Route': the prop is not a valid React component #6791

Closed
Kashio opened this issue Jun 16, 2019 · 2 comments

Comments

@Kashio
Copy link

Kashio commented Jun 16, 2019

I have a reference to an object containing getComponent(...) method for obtaining a React component.
I try to render this component inside a nested route like so:

const component = React.cloneElement(object.getComponent(...), {...});
<Route path={`home/${object.route}`} component={component}/>;

and I get the following error:
Failed prop type: Invalid prop 'component' supplied to 'Route': the prop is not a valid React component.
I've seen similar issues like 6741
where the issue is resolved by upgrading the library version to react-router-dom@5.0.0, but my dependencies are up-to date:

"react": "^16.4.2",
"react-dom": "^16.4.2",
"react-router-dom": "^5.0.0"

Any ideas on how can I solve this problem ?

@timdorr
Copy link
Member

timdorr commented Jun 16, 2019

Do you also have react-is installed? That needs to be the same version as React for it to work.

@support
Copy link

support bot commented Jun 16, 2019

👋 @Kashio, we use the issue tracker exclusively for bug reports and feature requests. However, this issue appears to be a support request. For usage questions, please use Stack Overflow or Reactiflux where there are a lot more people ready to help you out.
Please feel free to clarify your issue if you think it was closed prematurely.

@support support bot closed this as completed Jun 16, 2019
@lock lock bot locked as resolved and limited conversation to collaborators Aug 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants