Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "form"

Index

Type aliases

TypeCursorPositionState

TypeCursorPositionState: {}

Type declaration

Variables

Const FormConsumer

FormConsumer: ExoticComponent<ConsumerProps<IFormContext>> = FormContext.Consumer
var

Access the form state within a React Context Api Consumer scope

example

For example:

<Form state={this.state} context={this}>
     <FormConsumer>
     {({state}) => {
         return <div>{state} is equal {myState}</div>;
     }}
   </FormConsumer>
</Form>

Functions

Const Form

  • Form(props: IForm): Element
  • The main Form component that is required to wrap all RBF components. If the component that uses the Form component is a functional component then only the state props & state update function returned from the useState hook are required. If you are calling Form component from a class component then you must pass your local context or this keyword to the context prop.

    example
    // Minimal setup for a RBF's Form component
    
     const myState = {
         username: '',
     }
     const [state, setState] = React.useState(state);
     <Form state={myState} context={setState}></Form>

    To use RBF Form component from a class component you must pass in your local state of this keyword.

    example
    // Minimal setup for a RBF's Form component for a class component
    
     this.state = { // in the constructor
         username: '',
     }
    
     <Form state={this.state} context={this}></Form>

    Parameters

    • props: IForm

      IForm

      An example using RBF Form component in a functional component

    Returns Element

Generated using TypeDoc