Skip to content

Commit

Permalink
Merge pull request #46 from pierpo/fix/example-breaking-when-removing…
Browse files Browse the repository at this point in the history
…-all-the-elements

fix: example breaking when removing all the elements
  • Loading branch information
pierpo authored May 2, 2019
2 parents 9b7b286 + 95d301c commit 8e18ce6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion example/SecondExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ class SecondExample extends React.Component {
</button>
<button
onClick={() =>
this.setState({ nbElements: this.state.nbElements - 1 })
this.setState({
nbElements:
this.state.nbElements > 1 ? this.state.nbElements - 1 : 0,
})
}
>
-
Expand Down

0 comments on commit 8e18ce6

Please sign in to comment.