Emotion.js


Emotion.js

개념 emotion.js는 CSS-in-JS의 종류 중 하나로 JavaScript 안에서 스타일을 작성할 수 있게 해준다. Framework를 사용하지 않는 것 React를 사용하는 것 두 가지가 있다. # Framework Agnostic $ npm install @emotion/css # React $ npm install @emotion/react 사용 /** @jsxImportSource @emotion/react */ import { jsx, css } from '@emotion/react' 위 코드를 import해야 사용할 수 있다. 사용 예시 /** @jsxImportSource @emotion/react */ import { css, jsx } from '@emotion/react' const styled = css` color: red; ` function Home() { return( <div css={styled}>Hello world</div> ) } expor...


#Emotion #JavaScript #이모션

원문링크 : Emotion.js