exeform
  • Getting Started
  • Motivation
  • How It Works
  • Guides
    • Validation
    • Nested Structures
  • API
    • Form
    • Field
    • <Form />
    • useForm()
    • useField()
    • useCheckboxField()
    • useFieldValue()
    • useFormIsValid()
    • useFormContext()
Powered by GitBook
On this page
  • Import
  • Types
  • Example

Was this helpful?

  1. API

useFieldValue()

PrevioususeCheckboxField()NextuseFormIsValid()

Last updated 3 years ago

Was this helpful?

This hook subscribes to the part of the form specified in name and returns value.

Import

import { useFieldValue } from 'exeform';

Types

useFieldValue(name: string): any

Example

For nested values, use name as described .

const Items = () => {
  const items = useFieldValue('items');

  return (
    <div>
      {items.map((item, index) => (
        <Item name={`items[${index}]`} />
      ))}
    </div>
  );
};
here