map
예제코드
import React, { Component } from 'react'
class IterationSample extends Component {
render() {
const names = ['참외', '복숭아', '수박']
const nameList = names.map(name => <li>{name}</li>)
return <ul>{nameList}</ul>
}
}Key
예제코드
const nameList = names.map((name, index) => <li key={index}>{name}</li>)state 변경 시 push 혹은 concat ?
state 에서의 filter 사용
Last updated