many developers prefer Emotion to other CSS-in-JS alternatives because of its small size, high performance, and overall flexibility.
โ Emotion ์ฅ์ : 1. ํ์ผํฌ๊ธฐ๊ฐ ์๋ค, 2. ๊ณ ์ฑ๋ฅ, ์ ๋ฐ์ ์ธ ์ ์ฐ์ฑ. ๊ฐ๋ฐ์์นํ์ .
๋ฌธ๋ฒ์ด ๋น์ทํ๊ฑฐ๊ฐ์๋ฐ, ์ด์ง ๋ค๋ฅธ๊ฑฐ๊ฐ๋ค
Emotion์ string style์์ฑ๋ฒ๊ณผ object style ์์ฑ๋ฒ์ด ์๋ค.
โ ์ฐจ์ด์ ์
string ์คํ์ผ์ ํ๊ทธ์์ css={css`background:'black'; &:hover {color:'white'};`}
object์คํ์ผ์ ํ๊ทธ์์ css={{ background: 'black' , '$:hover': {color:'white'} }}
๋ณดํต props๋ก ๊ด๋ฆฌํ ๋ณ์๋ ์ง์ ์ ์ธ ๋ฐ ํ ๋น์ ํด์ฃผ๊ณ
const color = 'white' <div css={css`border:solid; background: black; &:hover { color:${color};}`} >์๋ ํ์ธ์</div>
ย