UNPKG

materialuibasecomponent

Version:

Typescript Base Class for Material-UI Styled/Themed React Components

20 lines (19 loc) 759 B
import * as React from 'react'; import { StyledComponentBase } from './StyledComponentBase'; export class WrappedStyledComponentBase extends StyledComponentBase { constructor(props, context) { super(props, context); this.state = Object.assign({}, this.state, { value: { getContent: context.getContent, wrappingComponent: context.wrappingComponent } }); } render() { const { value, Context } = this.state; const { getContent, wrappingComponent } = value; if (getContent && Context) { return (React.createElement(Context.Consumer, null, getContent.bind(wrappingComponent, this.props.classes))); } return null; } }