@karsegard/cex

1.4.4 • Public • Published

react-gen-classes

Alt text

  import gen from '@geekagency/gen-classes'


  export default props=>{
    const classnames = gen(
      [

        'always-here-class', // pass a string, it will always be present

        {'conditional_class': _=> props.active ? true: false}, // if you pass an object, it's value will be called as a function and given the result will apply the key as a class

        props=> props.test=='world' ? 'hello-world': ''  // if you pass a function, It'll just append the output if not empty

      ]
    )

    return (<h1 className={classnames}>test</h1>)
  }

Readme

Keywords

none

Package Sidebar

Install

npm i @karsegard/cex

Weekly Downloads

1

Version

1.4.4

License

MIT

Unpacked Size

301 kB

Total Files

25

Last publish

Collaborators

  • fdt2k