UNPKG

@equinor/eds-utils

Version:

Utility functions and hooks for the Equinor Design System

10 lines (8 loc) 352 B
// React 18 stores the ref on `element.ref`; React 19 stores it on `element.props.ref`. // Read props.ref first to avoid the React 19 deprecation warning on element.ref access. const getElementRef = element => { const propsRef = element.props?.ref; if (propsRef != null) return propsRef; return element.ref ?? null; }; export { getElementRef };