react-css-modules-psh
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

React CSS modules: Partially applied styles HOC

In case you need to get a higher-order component with the styles already provided, you can do it that way:

import styles from './styles/Component.module.css';
import withStyles from 'react-css-modules-psh';

type OwnProps = { /* props. */ };

const Component: React.FC<OwnProps> = () => (
  <div styleName='Component' />
);

const withStylesApplied = withStyles(styles);
export default withStylesApplied;

You can also pass the result of the function to Redux compose function:

export default compose<React.Component<OwnProps>>(
  // ...,
  connect(mapStateToProps, mapDispatchToProps),
  withStyles(styles) // Need to be the first one.
)(Component);

That only works for functional components.

/react-css-modules-psh/

    Package Sidebar

    Install

    npm i react-css-modules-psh

    Weekly Downloads

    4

    Version

    1.1.1

    License

    MIT

    Unpacked Size

    4.46 kB

    Total Files

    7

    Last publish

    Collaborators

    • mavedev