jeonghwan-kim / jeonghwan-kim.github.com

김정환 블로그 코드 저장소 입니다.
https://jeonghwan-kim.github.io/
BSD Zero Clause License
41 stars 9 forks source link

dev/2020/10/25/styled-components.html #261

Closed jeonghwan-kim closed 3 years ago

jeonghwan-kim commented 3 years ago

styled-component로 리액트 컴포넌트 만들기

https://jeonghwan-kim.github.io/dev/2020/10/25/styled-components.html

jeonghwan-kim commented 3 years ago

좋은 글 감사합니다! 특히 css()는 안 써봤는데 한 번 활용해 봐야 겠네요
혹시 타입스크립트 사용하시나요? props 전달에 대해 질문이 있는데 혹 시간이 되신다면 한 번 봐 줄 수 있나요?
타입스크립트와 같이 사용한다면 다음과 같이 편리한 (인텔리센스?, 코드 힌트?) 를 사용할 수 있습니다.
https://uploads.disquscdn.c...

하지만 다음과 같이 코드를 감싸고 모듈화를 한다면 좋지만,
https://uploads.disquscdn.c...

이렇게 한다면 편리한 코드 힌트 기능은 사용할 수 없고,
https://uploads.disquscdn.c...

다음과 같이 컴포넌트를 감싸서 작업한다고 하면
https://uploads.disquscdn.c...
추가 props를 전달할 때 타입 힌트가 안 나옵니다. (그리고 onClick 같은 걸 걸때도 오류가 나옵니다 ㅠ.ㅠ) 혹시 나오게 하는 방법 알고 계신가요?)
https://uploads.disquscdn.c...
https://uploads.disquscdn.c...

_Disqus에서 작성한 댓글입니다. 2020-10-26 12:01:57 최종근(disqusG0tAtdrrem)

jeonghwan-kim commented 3 years ago

제 댓글 왜 스팸 처리된건가요?

_Disqus에서 작성한 댓글입니다. 2020-10-26 12:05:45 최종근(disqusG0tAtdrrem)

jeonghwan-kim commented 3 years ago

디스커스로 댓글을 관리하는데 따로 스팸 처리된건 없는것 같아요

_Disqus에서 작성한 댓글입니다. 2020-10-28 08:03:44 김정환(jeong_hwankim)

jeonghwan-kim commented 3 years ago

css modules도 사용해보셨나요? 이걸 사용하면 클래스명 중복문제가 해결이되고 CSS와 컴포넌트간의 클래스명의 동일성도 유지됩니다.

_Disqus에서 작성한 댓글입니다. 2021-01-26 07:17:25 김초롱(disqusZAac3jhDvN)