Loading

withTheme() styled-compon

  1. /* withTheme higher order component of styled-component isn't working */
  2.  
  3. import React from 'react';
  4. import PropTypes from 'prop-types';
  5. import styled, { withTheme } from 'styled-components';
  6.  
  7. const defaultProps = { className: 'success' };
  8. const propTypes = { className: PropTypes.string };
  9.  
  10. class Test extends React.Component {
  11.   render() {
  12.     const { className } = this.props;
  13.     return (
  14.       <div className={className}>test</div>
  15.     );
  16.   }
  17. }
  18.  
  19. Test.defaultProps = defaultProps;
  20. Test.propTypes = propTypes;
  21.  
  22. /** @component */
  23. export default withTheme(Test);