React, Next
[REACT] 이미지 업로드 버튼 꾸미고 연결하기!
재원쓰
2023. 4. 11. 20:32
const PostForm = () => {
const imageInput = useRef();
const onClickImageUpload = useCallback(() => {
imageInput.current.click()
}, [imageInput.current])
return (
<>
<input type="file" multiple hidden ref={imageInput} />
<Button onClick={onClickImageUpload}>이미지 업로드</Button>
</>
)
}