Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update readme.md #84

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can or cannot? :D

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, @maullerz, I don't understand what you mean. Did i make a mistake? :)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, not you, just typo was in original source, and you can fix it at same time in this PR

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anorudes i've made a PR to your branch with the fix of the validation message anorudes#1

})

// ...in a component
render(){
render() {
return (
<Form
schema={modelSchema}
value={this.state.model}
onChange={model => this.setState({ model})}
onChange={model => this.setState({ model })}
>
<fieldset>
<legend>Personal Details</legend>
Expand Down