preactjs / preact-compat

ATTENTION: The React compatibility layer for Preact has moved to the main preact repo.
http://npm.im/preact-compat
MIT License
949 stars 148 forks source link

findDOMNode is different from react-dom #493

Closed zhaopeifei closed 6 years ago

zhaopeifei commented 6 years ago

function findDOMNode() { return e && e.base || null }

but in react-dom function findDOMNode(componentOrElement) { // ... if (componentOrElement == null) { return null; } if (componentOrElement.nodeType === 1) { return componentOrElement; } // ...

so when I use findDOMNode(element),react-dom return element,but preact return null. This cause react-slick make a mistake.

billneff79 commented 6 years ago

We are encountering the same issues with react-slick. I created a fix for this issue in PR #495

rdmurphy commented 6 years ago

Can confirm this is triggering errors in react-autocomplete too.

dandv commented 6 years ago

@mlaursen suspects that findDOMNode may also cause the incompatibility with react-md. I've made sure preact-compat is at 3.18.4 in my reproduction repo (linked above), but I still see the issue.

billneff79 commented 6 years ago

I added notes to the issue in react-md: findDOMNode is not causing the issue they are seeing, but rather a lower level preact bug.