티스토리 뷰
반응형
[react/javascript] 리액트+tailwindcss+twin.macro
# 리액트 설치
npx create-react-app my-app
# emotion / tailwind / twin.macro 설치
npm i @emotion/css @emotion/react @emotion/styled
npm i -D tailwindcss postcss autoprefixer
npm i twin.macro
npx tailwindcss init -p
# ./tailwind.config.js
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./src/**/*.{html,js,jsx}"],
theme: {
extend: {},
},
plugins: [],
}
#./src/index.css
@tailwind base;
@tailwind components;
@tailwind utilities;
# App.js
/** @jsxImportSource @emotion/react */
import './App.css';
import tw from 'twin.macro';
function App() {
const color = "white";
const Input = () => <input tw="border hover:border-black bg-red-500" />
return (
<div
css={tw`bg-red-100`}
>
<Input/>
안녕하세요
</div>
);
}
export default App;
#react #emotion #tailwind #twin.macro
반응형
'자바스크립트(javascript)' 카테고리의 다른 글
[react/javascript] 목업 데이터로 작업하기 (0) | 2022.12.27 |
---|---|
[css/javascript] simple image swipe(drag)이미지 스와이핑 드래그 (0) | 2022.12.21 |
[react/javascript] 태블릿/모바일 구분하기 (0) | 2022.11.24 |
[react/javascript] 모바일 orientation (가로/세로) 상태 받아오기 (0) | 2022.11.23 |
[react/javascript] 디바이스 / 브라우져 체크하기 (0) | 2022.11.23 |
댓글
반응형