Skip to content

Commit

Permalink
update return type
Browse files Browse the repository at this point in the history
  • Loading branch information
sai6855 authored and aarongarciah committed Sep 19, 2024
1 parent 2852483 commit abe26e2
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import * as React from 'react';
* It will throw runtime error if the element is not a valid React element.
*
* @param element React.ReactElement
* @returns React.Ref<any> | null
* @returns React.Ref<any> | null | undefined
*/
export default function getReactElementRef(element: React.ReactElement): React.Ref<any> | null {
export default function getReactElementRef(
element: React.ReactElement,
): React.Ref<any> | null | undefined {
const reactMajorVersion = parseInt(React.version.split('.')[0], 10);

// 'ref' is passed as prop in React 19, whereas 'ref' is directly attached to children in older versions
Expand Down

0 comments on commit abe26e2

Please sign in to comment.