From 60399882d4f390f64ed137ad22d0f9e44486942e Mon Sep 17 00:00:00 2001 From: anorudes Date: Fri, 2 Sep 2016 22:06:11 +0500 Subject: [PATCH] Update readme.md --- README.md | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 69022d4..0af21ae 100644 --- a/README.md +++ b/README.md @@ -20,25 +20,25 @@ __For more complete api documentations, live examples, and getting started guide `react-formal` uses a [yup](https://github.com/jquense/yup) schema to update and validate form values. It treats the `form` like an input (representing an object) with a `value` and `onChange`. The `form` can be controlled or uncontrolled as well, just like a normal React input. ```js -var yup = require('yup') - , Form = require('react-formal') - -var modelSchema = yup.object({ - name: yup.object({ - first: yup.string().required('Name is required'), - last: yup.string().required('Name is required') - }), - dateOfBirth: yup.date() - .max(new Date(), 'You can be born in the future!') - }) +import yup from 'yup'; +import Form from 'react-formal'; + +const modelSchema = yup.object({ + name: yup.object({ + first: yup.string().required('Name is required'), + last: yup.string().required('Name is required') + }), + dateOfBirth: yup.date() + .max(new Date(), 'You can be born in the future!') +}) // ...in a component -render(){ +render() { return (
this.setState({ model})} + onChange={model => this.setState({ model })} >
Personal Details