Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 | 31 |
Tags
- 커스텀알락
- 파이썬
- leetcode189
- 프로토타입
- 파이어베이스로그인
- 다리놓기
- Rest
- 리액트
- React
- nvmrc
- 타입스크립트
- css
- leetcode977
- nvm
- Next.js
- react-native
- iP
- 백준
- youtube iframe
- yarn-berry
- react-firebaseui
- 구조분해할당
- 커스텀알림
- Python
- 자바스크립트
- Spread
- 기초
- mac
- JS
- firebaseui
Archives
- Today
- Total
JadeCode
RN styled-components 본문
styled-components
리액트에서 처음 styled-components를 사용해보았을 때 센세이션을 느껴 react-native에서도 사용할 것이다.
스타일을 컴포넌트화 해서 다양한 곳에 사용할 수 있고 props로 값을 넘겨 다양한 스타일링이 가능하다는 장점이 있다.
npm install styled-components
npm install @types/styled-components @types/styled-components-react-native //TypeScript
하지만 styled-component로 코드를 작성하면 치명적인 단점이 있다. className이 해시값으로 만들어지기 때문에 스타일을 수정할 때 애를 먹는다.
그래서 babel-plugin-styled-components는 해당 스타일의 컴포넌트 이름을 해쉬값 앞에 붙여 나온다.
npm install babel-plugin-styled-components
babel.config.js에 styled-components관련 부분 추가
plugins:[
...
"babel-plugin-styled-components",
]
https://styled-components.com/
styled-components
Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress 💅🏾
styled-components.com
'개발 > 리액트네이티브' 카테고리의 다른 글
RN 디버깅 에러 핸들링 (0) | 2022.10.30 |
---|---|
RN ScrollView vs. FlatList (0) | 2022.10.19 |
RN 가상머신 설치 (0) | 2022.10.17 |
RN 절대경로 (typescript) (1) | 2022.10.15 |
React Native 개념 (0) | 2022.10.14 |
Comments