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 |
Tags
- plot in r
- asynchronization
- 광명시버스분석
- 탈출문자
- 값삭제
- 이용현황분석
- DataFrame
- 버스분석
- 백준
- React
- 백준 11718
- getline
- react #회원가입 #비밀번호비교
- setstate
- 10172
- barplot
- useState
- 값추가
- 배열삭제
- 배열추가
- 데이터분석
- 그래픽
- R 그래프
- await
- 그대로 출력하기
- vetor
- R데이터형태
- 백준 10172
- 이스케이프시퀀스
- barplot in r
Archives
- Today
- Total
devlog_zz
React Native ScrollView 본문
728x90
ReactNative ScrollView
export default function App() {
const [people, setPeople] = useState([
{name:'aaa',key:'1'},
{name:'bbb',key:'2'},
{name:'ccc',key:'3'},
{name:'ddd',key:'4'},
{name:'eee',key:'5'},
{name:'fff',key:'6'},
{name:'ggg',key:'7'},
])
return (
<View style={styles.container}>
<ScrollView>
{people.map((item)=>{
return (
<View key={item.key}>
<Text style={styles.item}>{item.name}</Text>
</View>
)
})}
</ScrollView>
</View>
);
}
코드 리팩토링 후
map 인자 하나니까 () 없애고, {return } 제거
return (
<View style={styles.container}>
<ScrollView>
{people.map(item=>
(
<View key={item.key}>
<Text style={styles.item}>{item.name}</Text>
</View>
))}
</ScrollView>
</View>
);
}
728x90
'Front End > React Native' 카테고리의 다른 글
React Native TouchableOpacity (0) | 2021.01.18 |
---|---|
React Native FlatList (0) | 2021.01.18 |
React Native useState , TextInput (0) | 2021.01.18 |
Button (0) | 2021.01.18 |
React Native <View>, <Text>, style, styled-components (0) | 2021.01.18 |
Comments