[5-4]글 수정/삭제 기능 구현하기(2) - API연동 부분에서 수정하기 누르면 제목과 내용이 비어있는데요,,, 한번 더 수정하기 눌러야 이전 제목과, 내용이 나옵니다...
저도 이 문제 때문에 어떤식으로 처리해야할지 몰랐는데 처리했습니다 감사합니다 const postForm = useForm({ // defaultValues: { // title: post?.title, // description: post?.description, // imageUris: post?.imageUris, // }, }); // useEffect를 사용해서 서버에서 받아온 게시글(post) 정보를 postForm이라는 폼(form)에 채워 넣는 코드 useEffect(() => { if (post) { postForm.reset({ title: post?.title, description: post?.description, imageUris: post?.imageUris, }) } }, [post, postForm])