fisshy / react-scroll

React scroll component
https://github.com/fisshy/react-scroll/blob/master/README.md
MIT License
4.36k stars 437 forks source link

"parentbindings" causing test warning / showing up in html when using HOC #471

Open panmona opened 3 years ago

panmona commented 3 years ago

I created my own Element to directly use a list item tag:

const ListElement: React.FC = ({ children, ...props }) => {
  return <li {...props}>{children}</li>;
};
const ScrollListElement = ScrollElement(ListElement);

// ...

<ScrollListElement
   key={id}
   name={scrollBaseName + id}
>
  // ...
</ScrollListElement>

But now my li tag also has a "parentbindings" property: <li name="scroll-123" parentbindings="[object Object]">

This is also issuing a warning in tests:

Warning: React does not recognize the parentBindings prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase parentbindings instead. If you accidentally passed it from a parent component, remove it from the DOM element.

What is the reason for this? Can this be fixed in the library? I would be open to implement this but I would need some guidance.