reactnative flex vs react flex 차이

낭만개발자·2022년 5월 1일
0

트러블슛팅

목록 보기
14/17

reactNative 하다가 react로 돌아와서 css에서 flex:1을 주는데 왜 안먹지??
이상하다 하고 몇시간동안 삽질 했다 ..

react는 display:flex를 해주고 flex:1 처럼 속성을 해줘야한다.
reactNative 는 달리 display:flex 안해줘도 flex:1 만주면 바로 적용이 된다 제길

https://medium.com/the-react-native-log/understanding-react-native-flexbox-layout-7a528200afd4

styled-components

styled-components 라이브러리도 react랑 reactNative랑 다르다.

예로
reactNative에선

const Title = styled.Text`
font-family : ''
`

위처럼 사용이 가능한데 React에선

const Title = styled.h1`
font-family : ''
`

https://burkui-developer.tistory.com/20 여기 블로그에 이유가 나온다.

React, RN 둘다 jsx 문법을 사용하지만
React는 html 문법을 사용하고, RN은 html 문법을 사용하지 않는다. 그래서
RN은 <h1> 태그가 존재하지 않고, React는 <h1>가 존재한다. 그 차이임.

profile
낭만닥터와 슬의를 보고 저런 개발자가 되어야 겠다고 꿈꿔봅니다.

0개의 댓글