행복한 시지프

  • 홈
  • 삶에 대한 생각
  • 기술

Theme 1

선언병합을 활용하여 CSS in JS의 theme 타입 추론하기

이번 글은 TypeScript와 styled-components나 emotion을 함께 사용할 때, theme의 타입을 추론하는 방법을 다룹니다. 그 방법은 간단하지만, 숨겨진 원리가 있습니다. 방법을 먼저 설명한 후, 원리를 설명하도록 하겠습니다. theme 타입 추론하기 emotion, styled-components를 사용하면 아래와 같이 theme을 선언하고, ThemeProvider에 theme을 props로 넣어줍니다. // index.tsx const theme = { primary_500: '#FF5622', primary_400: '#FF7020', primary_300: '#FF9620', primary_200: '#FFB25B', primary_100: '#FFC17B', }; roo..

Tech/Sofeware Development 2022.09.18
이전
1
다음
더보기
프로필사진

행복한 시지프

Software engineer, Educator @Woowabros

  • 분류 전체보기 (80)
    • Tech (27)
      • Sofeware Development (19)
      • Clean Code (4)
      • Algorithm (0)
      • 우아한테크코스 (4)
    • Writing (50)
      • 삶에 대한 생각 (28)
      • 책 (3)
      • 회고 (17)
      • Self integrity report (2)
    • Education (2)

방문자수Total

Copyright © Kakao Corp. All rights reserved.

  • Github

티스토리툴바