question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

validateGetRootPropsCalledCorrectly does not correctly check if the root props are applied

See original GitHub issue
  • downshift version: 1.14.0
  • node version:
  • npm (or yarn) 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:closed
  • Created 6 years ago
  • Comments:15 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
tansongyangcommented, Oct 23, 2017

Reopening since this conversation is taking a different direction.

1reaction
kentcdoddscommented, Oct 23, 2017

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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found