/react-classnames

React class names helper.

Primary LanguageJavaScriptMIT LicenseMIT

ClassNames

Description

A decorator to create add a convenient classNames prop.

Demo

npm start dev then visit http://127.0.0.1:3000

Usage

import classNames from 'react-classnames';

@classNames
export default class Demo extends React.Component {
  render() {
    return (
      <div>
        <div classNames='Demo'/>
        <div classNames={ ['main', false && 'hidden', true && 'visible'] } className='other-class'/>
      </div>
    );
  }
};

Customize

Use the factory to customize :

import { factory } from 'react-classtree';
const classes = factory({ propName: 'classes' });