I'm working with react-hook-form and I want to pass a rich text editor as input. I've included the RichText component below which is a standard Draft-js implementation, but when I click submit, I get "draft: undefined" instead of the text inside the editor
index.js import { useForm, Controller } from 'react-hook-form';
const JobPostForm = () => {
const { register, handleSubmit, errors, control } = useForm({
});
return(
<Controller
as={<RichText />}
name="draft"
control={control}
/>
)
}
RichText.js
<Editor
customStyleMap={styleMap}
ref={editor}
editorState={editorState}
onChange={editorState => setEditorState(editorState)}
/>