mymergeclassnames

    1.0.1 • Public • Published

    mergeClassNames

    Merges class names, whatever the format. Can be a single class, a string with multiple classes separated with space, an array of classes Removes duplicates

    Install

    # Install using npm 
    npm install @maximusft/mergeclassnames@1.0.0 --save

    Use

    import mergeClassNames from 'mergeclassnames';
     
    export default (props) => {
        const { someClassNames } = props;
        /* Expample:
            someClassNames = ['a', false, 'b', 'c', null, ['d', null], () => {}, 'e', undefined, 'c', ['f', false]];
        */
        return (
          <div className="my-component">
            <SomeElement
                className={mergeClassNames('someHardCoreClass', someClassNames)}
            />
            {/*
            Output: <SomeElement className="someHardCoreClass a b c d e f" />
            */}
          </div>
        );
      }
    }

    Install

    npm i mymergeclassnames

    DownloadsWeekly Downloads

    2

    Version

    1.0.1

    License

    MIT

    Unpacked Size

    9.61 kB

    Total Files

    10

    Last publish

    Collaborators

    • logonod