Next.js Discord

Discord Forum

Need helps with new NextJS <Form> component!

Answered
sh1ro posted this in #help-forum
Open in Discord
Avatar
How can I pass my ref attribute to the <Form> component? It just keeps showing a TypeScript error.
Image
Image
Answered by joulev
const ref = useRef<HTMLFormElement>(null);

<Form ref={ref}>
View full answer

3 Replies

Avatar
@sh1ro How can I pass my `ref` attribute to the `<Form>` component? It just keeps showing a TypeScript error.
Avatar
const ref = useRef<HTMLFormElement>(null);

<Form ref={ref}>
Answer
Avatar
@joulev ts const ref = useRef<HTMLFormElement>(null); <Form ref={ref}>
Avatar
Oh thanks, I forgot it was TypeScript not vanilla JS.
Iā€™m currently using a phone. How can I close the post?