[Next js] 인풋과 라벨 연결값 고정문제

임보라·2024년 11월 11일

Next.js

목록 보기
6/23

//인풋과 라벨 연결값이 텍스트로 넣어놓음 -> 고정값으로 지칭하는 지역이름이 같아 계속 처음 지역에만 이미지가 넣어짐
//인풋과 라벨 연결값은 유니크한값으로 지역이름의 변수로 변경 -> 각 지역별로 이미지는 들어가지만 전체보기에서 파일자체가 열리지않음
//->기존 고정변수명+유니크한값으로 변수명을 수정함

<input
      id={`fileInput-${item}`}
      className="hidden"
      type="file"
      accept="image/*"
      multiple
      onChange={OnChangePhoto}
    />
    <label
      htmlFor={`fileInput-${item}`}
      className="flex aspect-square cursor-pointer items-center justify-center bg-[#004157] text-[50px] text-white hover:bg-[#1b4755]"
    >

0개의 댓글