인프런 커뮤니티 질문&답변
답변 1
1
John Ahn
지식공유자
안녕하세요 ^^
아 근데 value={item.key} 로 해주셔야 해요 ^^
왜냐면 현재
<select onChange={continentChangeHandler} value={Continent}>
이 select에서 value가 Continent State 이잖아요 ㅎ
근데 Continent State이
const [Continent, setContinent] = useState(1)
숫자로 0 1 2 3 ... 이런식으로 되어있어요
그래서 option의 value도 숫자로 되어있는 key 값을 사용해주셔야 합니다 ^^
const Continents = [
{ key: 1, value: "Africa" },
{ key: 2, value: "Europe" },
{ key: 3, value: "Asia" },
{ key: 4, value: "North America" },
{ key: 5, value: "South America" },
{ key: 6, value: "Australia" },
{ key: 7, value: "Antarctica" }
]





