@mskcc/carbon-react
Version:
Carbon react components for the MSKCC DSM
24 lines (20 loc) • 606 B
JavaScript
/**
* MSKCC 2021, 2024
*/
import React__default from 'react';
/**
* Wrap a class component with a functional component. This prevents an end-user
* from being able to pass `ref` and access the underlying class instance.
*
* @param {ReactNode} Component
* @returns {ReactNode}
*/
function createClassWrapper(Component) {
function ClassWrapper(props) {
return /*#__PURE__*/React__default.createElement(Component, props);
}
const name = Component.displayName || Component.name;
ClassWrapper.displayName = `ClassWrapper(${name})`;
return ClassWrapper;
}
export { createClassWrapper };