Skip to content

Commit

Permalink
Very small change & README
Browse files Browse the repository at this point in the history
  • Loading branch information
mattp94 committed Dec 13, 2017
1 parent 21ed579 commit 50d9955
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,20 +150,25 @@ Here is a [basic example](https://codesandbox.io/embed/oq176zv629) with `<Valida

```js
import React, { Component } from 'react'
import { ValidationIn, validate } from 'react-easy-validation'
import { validate, ValidationIn } from 'react-easy-validation'

import Input from './Input'

class Example extends Component {
constructor(props) {
super(props)

this.state = { value: '' }
this.state = {
value: ''
}

this.handleChange = this.handleChange.bind(this)
}

handleChange({ target: { value } }) {
this.setState({ value })
this.setState({
value
})
}

handleSubmit(event) {
Expand Down
4 changes: 2 additions & 2 deletions src/components/Validation.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { Component } from 'react'
import PropTypes from 'prop-types'
import shallowequal from 'shallowequal'
import { cloneElement, Component } from 'react'

import { elements } from '../core'

Expand Down Expand Up @@ -45,7 +45,7 @@ export default class Validation extends Component {

renderChild(child, error, hint) {
this.setState({
child: hint === undefined ? child : React.cloneElement(child, {
child: hint === undefined ? child : cloneElement(child, {
[error]: hint
})
})
Expand Down

0 comments on commit 50d9955

Please sign in to comment.