cspace-ui
Version:
CollectionSpace user interface for browsers
25 lines (20 loc) • 484 B
JSX
import React from 'react';
import PropTypes from 'prop-types';
export default function withRecordType(BaseComponent) {
function WithRecordType(props, context) {
const {
recordType,
} = context;
return (
<BaseComponent
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
recordType={recordType}
/>
);
}
WithRecordType.contextTypes = {
recordType: PropTypes.string,
};
return WithRecordType;
}