React 16 throws error when extending and overriding getParentElement
See original GitHub issueDescribe the bug DOM element checks were added in React so on React@16.4.2 when using the suggested override for a custom scroll parent element you will receive this error in the console:
Warning: React does not recognize the `scrollParent` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `scrollparent` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
To Reproduce
- Clone this repo
- Under docs/package.json upgrade to react@16.4.2
- Run the demo and you should get the error
Expected behavior No console error
Device (please complete the following information):
- OS Mac
- Browser Chrome
- Version 69.0.3497.100
Suggested fix To move the class override to a prop with the same name. Effectively it’s the same solution, just how to pass the function through. If people agree with moving it to a prop, I’ll have a pull request out in the next few days.
Issue Analytics
- State:
- Created 5 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Error Handling in React 16 – React Blog
As React 16 release is getting closer, we would like to announce a few changes to how React handles JavaScript errors inside components....
Read more >Override for react-error-overlay@^6.0.9 conflicts with direct ...
You just have to remove the overrides section of your package.json file.
Read more >Safari Technology Preview Release Notes - Apple Developer
toMatrix() to throw an exception if its length is not compatible with a px unit ... Updated user-agent overrides to match options in...
Read more >ERROR in Plugin "react" was conflicted between "package ...
Ran into this problem today and it turned out that the esLintConfig setting I had for extends: [react-app] was conflicting with the settings...
Read more >How to Create a Form Type Extension (Symfony Docs)
First, create the form type extension class extending from ... Depending on your use case, you may need to override some of the...
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
You shouldn’t also derive new React components based on inheritance which means the suggested solution shouldn’t be to extend the base component.
A possible middle ground would be to pass a function that returns the scroll view. So the prop would be getScrollElement. That way the React component itself isn’t being passed through nor is the component being extended.
Based on your
thumbs-up
I moved it to using a prop function. Whenever you get a chance… https://github.com/CassetteRocks/react-infinite-scroller/pull/179