contextRef

ref object that can be used to access the context of a form

Overview

contextRef is a <Feathery.Form> prop that will set the current property of a ref to an instance containing form state and functions useful for interacting with the form.

Usage

You can set the current form step, update a field value, get the current step name, and more.

import { useRef } from 'react';
import { init, Form, FormContext } from '@feathery/react';

function App() {
  // Initialize Feathery
  init('SDKKey', 'support@feathery.io');
  const context = useRef<FormContext>(null);

  // After the Form is rendered, and the ref is set, you can
  // access any of the properties listed below
  setTimeout(() => context.current.setStep('New Step'), 1000);

  // Show the `aBcDeF` Feathery form
  return <Form
    formId='aBcDeF'
    // Fetch the Feathery form context
    contextRef={context}
  />
}

Last updated