React Hooks Form

React Hooks Form

  • Guides
  • Components
  • Hooks
  • Github

›Hooks

Getting Started

  • Overview
  • Usage

Guides

  • Organizing Your Fields
  • Client-side Validation
  • Server-side Validation
  • Input Components
  • Form Submission
  • Using Hooks

Components

  • <Form />
  • <FormField />

Hooks

  • useFormFieldValue
  • useFormFieldMeta
  • useFormValues
  • useFormMeta
  • useForm

useFormFieldValue

Use this hook to get the value of a field.

Signature

useFormFieldValue(fieldName[, formName])

Params

NameDescription
fieldNameName of the field
formNameOPTIONAL! Name of the form. You do NOT need to pass this if you use it inside the form context.

Return value

Value of the field.

Example

function Subtotal({ price }) {
  const qty = useFormFieldValue('qty');

  return (
    <span>Subtotal is {qty * price} dollars!</span>
  );
}
← <FormField />useFormFieldMeta →
  • Signature
  • Params
  • Return value
  • Example
Docs
Getting StartedGuidesComponentsHooks
Community
Stack Overflow
More
Star
Copyright © 2019 Mehdi Namvar