[React] input 태그에 대한 label에 for가 먹히지 않는 이슈

2022년 1월 20일

#React

<form method="post" encType="multipart/form-data">
    <label htmlFor="uploadFile">  
        <div>사진 업로드</div>
    </label>
    <input
        type="file"
        id="uploadFile"
        accept="image/*"
    />
</form>

해결 방안 : input 태그에 id를 label에는 for 대신 htmlFor 를 작성하면 된다.


Profile picture

주희(Joy)
가치를 고민하는 과정을 함께해요