Skip to content

Commit 86d0dc1

Browse files
committed
exploring state and events - part 3
1 parent c8c0da4 commit 86d0dc1

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

dropdown/src/button.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var React = require('react');
22

33
module.exports = React.createClass({
44
render: function() {
5-
return <button className={"btn " + this.props.className} type="button">
5+
return <button onClick={this.props.whenClicked} className={"btn " + this.props.className} type="button">
66
{this.props.title}
77
<span className={this.props.subTitleClassName}>{this.props.subTitle}</span>
88
</button>

dropdown/src/dropdown.jsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,18 @@ var Button = require('./button');
77
// var List = require('./list');
88

99
module.exports = React.createClass({
10+
handleClick: function() {
11+
alert('hello from dropdown');
12+
},
1013
render: function() {
1114

1215
return <div className="dropdown">
13-
<Button className="btn-default" title={this.props.title} subTitleClassName="caret" />
16+
<Button
17+
whenClicked={this.handleClick}
18+
className="btn-default"
19+
title={this.props.title}
20+
subTitleClassName="caret"
21+
/>
1422
</div>
1523
}
1624
});

0 commit comments

Comments
 (0)