validateGetRootPropsCalledCorrectly does not correctly check if the root props are applied
See original GitHub issuedownshift
version:1.14.0
node
version:npm
(oryarn
) version:
Reproduction repository: https://codesandbox.io/s/23yzon246r
Problem description:
I would like to use a non-DOM component as root component returned by the children function. I pass to it a prop rootProps
containing the result of getRootProps()
and it spreads the object to the inner root div
. In such a way, the root props that Downshift needs are correctly applied. However the validateGetRootPropsCalledCorrectly
throws an error.
Suggested solution:
I would suggest to either remove the check or to add a prop excludeSafetyChecks
that allows to bypass such a check.
Issue Analytics
- State:
- Created 6 years ago
- Comments:15 (5 by maintainers)
Top Results From Across the Web
How to test a prop update on React component - Stack Overflow
1. In actual practice, the render is not called explicitly in all cases. · 2. If you're testing a response to props changes...
Read more >Typechecking With PropTypes - React
The defaultProps will be used to ensure that this.props.name will have a value if it was not specified by the parent component. The...
Read more >How passing props to component works in React
Master how to pass props (properties) to components in React with this useful beginner's guide, including demo code.
Read more >How To Customize React Components with Props
Unlike most type systems, PropTypes is a runtime check, so if the props do not match the type the code will still compile,...
Read more >How State Works in React – Explained with Code Examples
The counter is correctly getting updated as you can see in the console – but it's not getting updated on the UI. This...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Reopening since this conversation is taking a different direction.
Ah, I see what you mean. Very interesting. Hmmm… I’m trying to think of a good way to keep the error but also allow you to do what you’re doing there because I think that it’s more likely people are making a mistake when you don’t pass a
refKey
and spreading on a composite component.What I’m thinking is that we could add an option you could pass to
getRootProps
that is:silenceRefError: true
or something like that. Then we’d update the error message to tell people they can use that if they know what they’re doing. What do you think?