@wix/design-system
Version:
@wix/design-system
14 lines • 599 B
JavaScript
import React from 'react';
import { InputContext } from '../../InputContext';
export const InputConsumer = ({ consumerCompName = 'InputConsumer', children, }) => {
if (typeof children !== 'function') {
throw new Error(`child of ${consumerCompName} must be a context consumer function`);
}
return (React.createElement(InputContext.Consumer, null, context => {
if (!context) {
throw new Error(`${consumerCompName} cannot be rendered outside the Input component`);
}
return children(context);
}));
};
//# sourceMappingURL=InputConsumer.js.map