src/theme/src/withTheme.js
function withTheme(WrappedComponent) {
  const displayName =
    WrappedComponent.displayName || WrappedComponent.name || 'Component'

  return class extends React.Component {
    static displayName = `withTheme(${displayName})`

    render() {
      return (
        <ThemeConsumer>
          {theme => <WrappedComponent theme={theme} {...this.props} />}
        </ThemeConsumer>
      )
    }
  }
}
function withTheme(WrappedComponent) {
  const displayName =
    WrappedComponent.displayName || WrappedComponent.name || 'Component'

  return class extends React.Component {
    static displayName = `withTheme(${displayName})`

    render() {
      return (
        <ThemeConsumer>
          {theme => <WrappedComponent theme={theme} {...this.props} />}
        </ThemeConsumer>
      )
    }
  }
}
function withTheme ( WrappedComponent ) { const displayName = WrappedComponent . displayName || WrappedComponent . name || 'Component' return class extends React . Component { static displayName = ` ${ displayName } ` render ( ) { return ( < ThemeConsumer > { theme => < WrappedComponent theme = { theme } { ... this . props } / > } < / ThemeConsumer > ) } } }
HOC that uses ThemeConsumer.
@param {React.Component} WrappedComponent - Component that gets theme.
HOC that uses ThemeConsumer .