TypeError: Cannot read property 'value' of null

정은경·2020년 7월 13일
0

👸 Front-End Queen

목록 보기
12/266

문제의 코드

  const onSelectCrop = (e) => {
    console.log(e.target.value);
    setOptions((options) => ({
      ...options,
      selectedCrop: e.target.value,
    }));
  };

해결된 코드

  const onSelectCrop = (e) => {
    console.log(e.target.value);
    const crop = e.target.value;
    setOptions((options) => ({
      ...options,
      selectedCrop: crop,
    }));
  };

Reference

profile
#의식의흐름 #순간순간 #생각의스냅샷

0개의 댓글