Skip to content

Commit

Permalink
exploring state and events - part 5
Browse files Browse the repository at this point in the history
  • Loading branch information
StephenGrider committed Mar 29, 2015
1 parent b2bf2d4 commit 3e8921a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions dropdown/src/dropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ var ListItem = require('./list-item');

module.exports = React.createClass({
handleClick: function() {
alert('hello from dropdown');
this.setState({open: !this.state.open});
},
getInitialState: function(){
return { open: false }
},
render: function() {
var list = this.props.items.map(function(item){
Expand All @@ -22,7 +25,7 @@ module.exports = React.createClass({
title={this.props.title}
subTitleClassName="caret"
/>
<ul>
<ul className={"dropdown-menu " + (this.state.open ? "show" : "") }>
{list}
</ul>
</div>
Expand Down

0 comments on commit 3e8921a

Please sign in to comment.