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
String is not a valid ComponentType #8380
Comments
What you are looking for is https://github.com/facebook/flow/blob/master/lib/react.js#L170 |
Hello @dsainati1 thanks for your response.
So what I ended up doing is : |
As I said, |
It doesn't make sense to pass in a component, because by doing You should just pass in an element: https://flow.org/try/#0PTAEAEDMBsHsHcBQBLAtgB1gJwC6gFSgCGAzqAEoCmRAxnpFrKqAERbV0sDcivOAnukqgACo3RkAvKADeiUKErRKqSgDscALgoccAOgCyyAB6UAJgFFlqjYgC+80Ihqw1JPACFoRUNIAUMkoq6lqKoHbaYrASAJS+AHyKvF5EemaUkEQArtA4URK+so5BNqEAPGbIAG6gwPEANPa8Lm54xoVlKbXxQA |
Why does not make sense? it is exactly the same thing high horder components do. I don't want an already instantiated component, I want a component that I will render adding the props that I want. This is a very common react pattern, and it is a key point to customize what certain components use to render themselves (like buttons, where you can specify to render using a Link, an |
OK, so what you want is something which accepts a component with specific props, not just arbitrary props, because you need to be able to pass some type of props to it (e.g. I don't think there is a way to express that for intrinsic elements (like |
Hello
I creating a component that takes a component to render as props. However, it's being impossible for me to type that it can accept both react components and default components (those defined by strings). Flow says that string is not a valid type for
ComponentType
Flow version: 0.125.1
Expected behavior
I expect string to be a valid component
Actual behavior
Only react components can be used
The text was updated successfully, but these errors were encountered: