Skip to content

Commit

Permalink
Bring back getReactNodeRef and deprecate it
Browse files Browse the repository at this point in the history
  • Loading branch information
aarongarciah committed Oct 29, 2024
1 parent 16c974c commit 04bcd80
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions packages/mui-utils/src/getReactNodeRef/getReactNodeRef.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import * as React from 'react';
import getReactElementRef from '../getReactElementRef';

/**
* Returns the ref of a React element handling differences between React 19 and older versions.
* It will throw runtime error if the element is not a valid React element.
*
* @param element React.ReactElement
* @returns React.Ref<any> | null
*
* @deprecated Use getReactElementRef instead
*/

export default function getReactNodeRef(element: React.ReactElement): React.Ref<any> | null {
return getReactElementRef(element);
}
1 change: 1 addition & 0 deletions packages/mui-utils/src/getReactNodeRef/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './getReactNodeRef';
1 change: 1 addition & 0 deletions packages/mui-utils/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@ export { default as unstable_useSlotProps } from './useSlotProps';
export type { UseSlotPropsParameters, UseSlotPropsResult } from './useSlotProps';
export { default as unstable_resolveComponentProps } from './resolveComponentProps';
export { default as unstable_extractEventHandlers } from './extractEventHandlers';
export { default as unstable_getReactNodeRef } from './getReactNodeRef';
export { default as unstable_getReactElementRef } from './getReactElementRef';
export * from './types';

0 comments on commit 04bcd80

Please sign in to comment.