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.

React 16 throws error when extending and overriding getParentElement

See original GitHub issue

Describe 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

  1. Clone this repo
  2. Under docs/package.json upgrade to react@16.4.2
  3. 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:closed
  • Created 5 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
k2snowman69commented, Oct 6, 2018

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.

0reactions
k2snowman69commented, Oct 7, 2018

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

Read more comments on GitHub >

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

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