Skip to content

Commit fbfb203

Browse files
authored
Merge pull request #1 from joshwnj/master
Fix some typos in the example
2 parents aee94fb + a41f79c commit fbfb203

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

README.md

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -44,27 +44,30 @@ Two things needs to be done to use **react-input-handler**:
4444
import React from 'react'
4545
import ReactInputHandler from 'react-input-handler'
4646

47-
class Form extends React.Component {
47+
export default class Form extends React.Component {
4848

4949
constructor(props) {
5050
super(props)
51+
52+
this.state = {}
53+
5154
this.handleChange = ReactInputHandler.bind(this)
52-
this.handleSubmit.bind(this)
55+
this.handleSubmit = this.handleSubmit.bind(this)
5356
}
5457

5558
render() {
5659
return (
57-
<form>
60+
<form onSubmit={this.handleSubmit}>
5861
<label>Fullname:</label>
5962
<input type="text" name="user.fullname" onChange={this.handleChange} />
60-
63+
6164
<label>Biography:</label>
62-
<textarea type="text" name="user.bio" onChange={this.inputHandler} />
63-
65+
<textarea type="text" name="user.bio" onChange={this.handleChange} />
66+
6467
<label> Are you a developer?</label>
65-
<input type="checkbox" name="user.developer" value="yes" onChange={this.inputHandler} />
66-
67-
<button onClick={this.handleSubmit}>Submit</button>
68+
<input type="checkbox" name="user.developer" value="yes" onChange={this.handleChange} />
69+
70+
<button type="submit">Submit</button>
6871
</form>
6972
)
7073
}
@@ -74,7 +77,6 @@ class Form extends React.Component {
7477
console.log(this.state)
7578
// Output: { user: { fullanme: "string", bio: "string", developer: true|false } }
7679
}
77-
7880
}
7981
```
8082

0 commit comments

Comments
 (0)