react-component / motion

⛷ CSS Animation for React
https://motion-seven.vercel.app
MIT License
150 stars 42 forks source link

calling deprecated findDOMNode only when it is necessary #17

Closed adaladam closed 3 years ago

adaladam commented 3 years ago

When the ref is passed explicitly to dom element it is not necessary to call the deprecated findDOMNode. In such cases we could directly return the ref.

In example below when the ref is passed explicitly we can internally store it and return the ref's value immediately to get HTMLElement, no need to call findDOMNode here. `

{(props, ref) =>
}

`

findDOMNode is called when there is no ref assigned and it is the only way to get the node like in the code example below. `

{(props, ref) =>
}

`

findDOMNode is also called when the child element is react class component which is not forwarding it's ref down to html element. `

{(props, ref) => }

`

vercel[bot] commented 3 years ago

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/react-component/motion/7ayBZSRyD1tmM6frooKc9FpyRo3Z
✅ Preview: https://motion-git-fork-adaladam-master-react-component.vercel.app

jquintozamora commented 3 years ago

@adaladam @afc163 just wondering if there is something stopping merge this PR. Thanks!

maltoze commented 2 years ago

We need a new release with this pr.