Skip to content

Commit b84c85d

Browse files
sai6855aarongarciah
authored andcommitted
use parseInt instead of split
1 parent abe26e2 commit b84c85d

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

packages/mui-utils/src/getReactElementRef/getReactElementRef.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ import * as React from 'react';
1010
export default function getReactElementRef(
1111
element: React.ReactElement,
1212
): React.Ref<any> | null | undefined {
13-
const reactMajorVersion = parseInt(React.version.split('.')[0], 10);
14-
1513
// 'ref' is passed as prop in React 19, whereas 'ref' is directly attached to children in older versions
16-
if (reactMajorVersion >= 19) {
14+
if (parseInt(React.version, 10) >= 19) {
1715
return element.props?.ref;
1816
}
1917
// @ts-expect-error element.ref is not included in the ReactElement type

0 commit comments

Comments
 (0)