0.1.1 • Published 8 years ago

class-map v0.1.1

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

ClassMap

Class definition utility for ReactJS

travisCI npm version

Install & Setup

npm install --save class-map

Use it for setting up the className property of a React component:

import React from 'react';
import { ClassMap } from 'class-map';

export class MyComponent extends React.Component {
  render() {
  
  	// create the class map:
    var map = new ClassMap({
      'btn': true,
      'btn-primary': this.props.isPrimary
    });
    
    return (
      <a className={map}>I am a primary button</a>
    );
  }
}

For more examples please refer to the test cases.