Redux form - sync validation example

Leff

I am going through the redux form documentation. I have come across this example. What I am wondering is where do we get from handleSubmit, pristine, reset, submitting, when deconstructing the props object in the SyncValidationForm:

const SyncValidationForm = (props) => {
  const { handleSubmit, pristine, reset, submitting } = props
  return (
    <form onSubmit={handleSubmit}>
      <Field name="username" type="text" component={renderField} label="Username"/>
      <Field name="email" type="email" component={renderField} label="Email"/>
      <Field name="age" type="number" component={renderField} label="Age"/>
      <div>
        <button type="submit" disabled={submitting}>Submit</button>
        <button type="button" disabled={pristine || submitting} onClick={reset}>Clear Values</button>
      </div>
    </form>
  )
}

Sinc, from what I could see we only pass the onSubmit property in the index.js:

<SyncValidationForm onSubmit={showResults} />
Peter Riesz

In the example SyncValidationForm is exported as a reduxForm:

export default reduxForm({
  form: 'syncValidation', // a unique identifier for this form
  validate, // <--- validation function given to redux-form
  warn // <--- warning function given to redux-form
})(SyncValidationForm)

This makes it a Higher Order Component similar to redux connect injecting the extra form props.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Redux Form Checkbox Validation

Redux-form validation on submit

Redux Form Field Array Validation

Regex for email validation in Redux form

Redux Form Validation for FieldArray in TypeScript

Angular Material 0.9.7 Form Validation Example

jQuery Form Validation simple example not working

How to test a redux form with async validation enabled

Async Validation Redux Form Error Uncaught promise

Redux Form validation symbol does not render in browser?

Redux-form async validation on optional field

Sync validation to throw form level error (rather then field level)

AngularJS validation gets out of sync when removing a form element

Working example of react-apollo 2.0 with redux-form

Make server validation using redux-form and Fetch API

React Dropzone + Redux form validation doesn't work

How can redux-form validation based on multiple fields be implemented?

redux form validation - Cannot read property 'some' of undefined

Redux Form 6.1.1 - validation on blur is not working on react-native

dispatch a action once server side validation passed in redux form

How to handle validation for Redux-Form FieldArrays with Immutable.js?

redux-form, validation breaks if using returned function

Redux-form password validation only after both fields touched

Angular validation not sync with HTML validation

redux Form 7.4.2 Server side validation not working with axios , gives error Unhandled Rejection (SubmissionError): Submit Validation Failed

Redux: async and sync dispatches

Redux-form validation breaks when using multiple components with the same form name

Form Validation

Spring-MVC: Need the most simple example of form-processing, binding, and validation