Skip to content

Commit

Permalink
Use immutable objects in input and checkbox specs
Browse files Browse the repository at this point in the history
  • Loading branch information
javivelasco committed Dec 7, 2015
1 parent 9e3ad3b commit 1951b64
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
2 changes: 1 addition & 1 deletion spec/components/checkbox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class CheckboxTest extends React.Component {
};

handleChange = (field, value) => {
this.setState({ [field]: value });
this.setState({...this.state, [field]: value});
};

handleFocus = () => {
Expand Down
4 changes: 1 addition & 3 deletions spec/components/input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ class InputTest extends React.Component {
};

handleChange = (name, value) => {
const newState = {};
newState[[name]] = value;
this.setState(newState);
this.setState({...this.state, [name]: value});
};

render () {
Expand Down

0 comments on commit 1951b64

Please sign in to comment.