Skip to content

Commit 12eb368

Browse files
committed
Bring back getReactNodeRef and deprecate it
1 parent 6679d01 commit 12eb368

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import * as React from 'react';
2+
import getReactElementRef from '../getReactElementRef';
3+
4+
/**
5+
* Returns the ref of a React element handling differences between React 19 and older versions.
6+
* It will throw runtime error if the element is not a valid React element.
7+
*
8+
* @param element React.ReactElement
9+
* @returns React.Ref<any> | null
10+
*
11+
* @deprecated Use getReactElementRef instead
12+
*/
13+
14+
export default function getReactNodeRef(element: React.ReactElement): React.Ref<any> | null {
15+
return getReactElementRef(element);
16+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { default } from './getReactNodeRef';

packages/mui-utils/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,6 @@ export { default as unstable_useSlotProps } from './useSlotProps';
4545
export type { UseSlotPropsParameters, UseSlotPropsResult } from './useSlotProps';
4646
export { default as unstable_resolveComponentProps } from './resolveComponentProps';
4747
export { default as unstable_extractEventHandlers } from './extractEventHandlers';
48+
export { default as unstable_getReactNodeRef } from './getReactNodeRef';
4849
export { default as unstable_getReactElementRef } from './getReactElementRef';
4950
export * from './types';

0 commit comments

Comments
 (0)