๐ด Introduction
โช html์์๋ class๋ฅผ ์ฌ์ฉํ์ฌ ํธํ๊ฒ css๋ฅผ ์ธ์ ์์ง๋ง React์์๋ class๊ฐ ์์ฝ์ด๋ก ์ฌ์ฉ์ค์ด๊ธฐ ๋๋ฌธ์ ์ด๋ฅผ ํด๊ฒฐํ๊ธฐ ์ํด ๋์จ ๋ผ์ด๋ธ๋ฌ๋ฆฌ
๐ Official
classnames
A simple utility for conditionally joining classNames together. Latest version: 2.3.1, last published: a year ago. Start using classnames in your project by running `npm i classnames`. There are 35414 other projects in the npm registry using classnames.
www.npmjs.com
๐ก Install

npm i classnames
๐ข Usage

// object value์ boolean ๊ฐ์ ํ๋ณํ๋ ์์ ๋ฃ์ด์ ์์ฉํ ์ ์๋ค.
classNames('foo', 'bar'); // => 'foo bar'
classNames('foo', { bar: true }); // => 'foo bar'
classNames({ 'foo-bar': true }); // => 'foo-bar'
classNames({ 'foo-bar': false }); // => ''
classNames({ foo: true }, { bar: true }); // => 'foo bar'
classNames({ foo: true, bar: true }); // => 'foo bar'
// lots of arguments of various types
classNames('foo', { bar: true, duck: false }, 'baz', { quux: true }); // => 'foo bar baz quux'
// other falsy values are just ignored
classNames(null, false, 'bar', undefined, 0, 1, { baz: null }, ''); // => 'bar 1'
'React > Library' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[ React ] react-beautiful-dnd (0) | 2022.08.08 |
---|---|
[ React ] react-hook-form (0) | 2022.08.04 |
[ React ] redux (0) | 2022.08.02 |
[ React ] react-router-dom (0) | 2022.07.31 |
[ React ] react-helmet (0) | 2022.07.30 |