inflearn logo
강의

강의

N
챌린지

챌린지

멘토링

멘토링

N
클립

클립

로드맵

로드맵

지식공유

harati님의 게시글

harati harati

@harati

수강평 작성수
1
평균평점
5.0

게시글 2

질문&답변

return()

map 돌릴 때 undefined is not an object 뜨시는 것은 아래처럼 물음표 넣어주시면 될 거 같아요. { item . phoneNumbers [ 0 ]?. number }

좋아요수
0
댓글수
5
조회수
449

질문&답변

return()

이렇게 말씀이신가요? {}로 감싸져 있기에 return이 2개 나 n개 인거는 문제가 아닌 거 같아요. render (){ return ( View style = { styles . container } > Text onPress = {this . changeState } style = { styles . text } > { this . state . sampleText } Text > { this . inputText () } Text onPress = {this . onAdd } style = { styles . text } > { this . state . sampleNum } Text > Text onPress = {this . changeState } style = { styles . text } > { this . state . sampleText } Text > { this . inputText () } Text onPress = {this . onAdd } style = { styles . text } > { this . state . sampleNum } Text > PropsChild sampleText = {this . state . sampleText } changeState = {this . changeState } /> Image source = { { uri : this . state . avatar } } style = { styles . avatar } > Image > Button title = "Add an Image" onPress = { () =>this . addImage () } /> Text onPress = {this . onAdd } style = { styles . text } > { this . state . avatar } Text > { this . state . myContacts . map (( item , idx ) => { return ( Text key = { idx } > { idx } { item . givenName } { item . phoneNumbers [ 0 ]?. number } Text > ) }) } Text > aaaa Text > Button title = "Load Contacts" onPress = { () =>this . getContacts () } /> View > ) }

좋아요수
0
댓글수
5
조회수
449