Skip to content

Instantly share code, notes, and snippets.

@prasanna1211
Created January 25, 2018 07:12
Show Gist options
  • Save prasanna1211/860e942ef698e03550cbdff1eec41ef0 to your computer and use it in GitHub Desktop.
Save prasanna1211/860e942ef698e03550cbdff1eec41ef0 to your computer and use it in GitHub Desktop.
const validate = values => { 
  /* returned object has all errors with name of field as key and error message as value */ 
  const errors = {}; 
  if (!values.userName) { 
    errors.userName = 'Please enter User Name'; 
  } // ... rest of conditions return errors; 
} 

const SampleForm = () => ( // ...sample form markup ); 

return reduxForm({ validate, ...otherValues })(SampleForm);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment