React & React Native

useActionState & useFormStatus

Në shqip përdoret i njëjti emër.

ShpjegimiSQ

React 19 solli hooks për formularë: useActionState mban rezultatin dhe gabimet e një veprimi, useFormStatus tregon nëse formulari po dërgohet — për të çaktivizuar butonin ose shfaqur „Duke ruajtur…“.

EnglishEN

React 19 brought hooks for forms: useActionState keeps an action's result and errors, useFormStatus tells you whether the form is submitting — to disable the button or show “Saving…”.

Si ta mendosh

Si drita e një ashensori që tregon kur po lëviz.

Lexoje në anglisht

Like a lift's light showing when it's moving.

Shembull kodijsx

function Butoni() {
  const { pending } = useFormStatus();
  return <button disabled={pending}>{pending ? "Duke ruajtur…" : "Ruaj"}</button>;
}

Terma të lidhur