Next.js Discord

Discord Forum

use form status

Unanswered
Beveren posted this in #help-forum
Open in Discord
BeverenOP
how to use this coz doesnt work, always log false only

const { pending } = useFormStatus();
console.log(pending)

1 Reply

@Beveren how to use this coz doesnt work, always log false only js const { pending } = useFormStatus(); console.log(pending)
The component calling this hook must be inside <form>.

This doesn’t work
function Foo() {
  const { pending } = useFormStatus()
  return <form></form>
}


This does
function Bar() {
  const { pending } = useFormStatus()
  return …
}

function Foo() {
  return <form><Bar /></form>
}