Skip to content

Conversation

@williamcotton
Copy link

Adds existingState property to the <Form /> component.

Pre-populates a form with existing data in a manner consistent with form.getValues().

import Form from 'react-validation/build/form';

const state = {
  title: "Existing Title",
  description: "An existing description.",
};

<Form existingState={state} />
  <TextInput name="title" validations={[required]} />
  <TextArea name="description" validations{[required]} />
</Form>

This is useful for CRUD applications where the same form will be used for both creating and editing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant