https://github.com/zordius/classnames-undefined
Wrap the classnames package for better behavior for react16
https://github.com/zordius/classnames-undefined
Last synced: about 1 year ago
JSON representation
Wrap the classnames package for better behavior for react16
- Host: GitHub
- URL: https://github.com/zordius/classnames-undefined
- Owner: zordius
- License: mit
- Created: 2017-11-15T01:21:13.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-16T01:43:28.000Z (over 8 years ago)
- Last Synced: 2024-10-06T03:21:42.503Z (over 1 year ago)
- Language: JavaScript
- Size: 5.86 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# classnames-undefined
Wrap the classnames package for better behavior for react16
[](https://travis-ci.org/zordius/classnames-undefined) [](https://github.com/zordius/classnames-undefined/blob/master/LICENSE.md) [](https://badge.fury.io/js/classnames-undefined)
## Install
```
npm install --save classnames-undefined
```
or
```
yarn add classnames-undefined
```
## Usage
Please refer to document of classnames , and we extend it with this behavior: when the return value of classnames is empty string, we turned it into `undefined`. This can help you to output better HTML when there is no classname for the elements.
```
const cn = require('classnames')
console.log(cn()) // will output empty string
const cu = require('classnames-undefined')
console.log(cu()) // will output undefined
```