import PropTypes from "prop-types"; import React from "react"; export default function context(name, type = PropTypes.any.isRequired) { return function contextDecorator(Component) { class ContextDecorator extends React.Component { static contextTypes = { [name]: type, } static displayName = "ContextDecorator" render() { return ; } } return ContextDecorator; }; }