Skip to content

Commit

Permalink
Modify state when getting items from action cable.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alejandro Ventura Contreras committed Apr 15, 2019
1 parent eb58a20 commit 994a418
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions todolist-react/src/components/App.js
Expand Up @@ -33,12 +33,13 @@ class App extends Component {
body: JSON.stringify({description: this.state.itemInput})
});

handleReceivedItems = response => {
const { item } = response;

this.setState({
itemInput: '',
items: [...this.state.items, { description: this.state.itemInput }]
items: [...this.state.items, item]
});
console.info("onSubmit: ", this.state)
}
};

render() {
return (
Expand Down

0 comments on commit 994a418

Please sign in to comment.