Skip to content

Commit 7c60354

Browse files
committed
Update example
1 parent 1b6621d commit 7c60354

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

example/main.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33

44
var App = React.createClass({
55
render(){
6-
var imgs = this._getImageList().map(function(url){
6+
var onClick = function(){ console.log('Clicked'); };
7+
var imgs = this._getImageList().map(function(url, index){
78
return React.createElement('div', {
8-
style: { width: '20%', float: 'left', 'margin-left': '10px' },
9-
}, Img({ src: url, key: url}));
9+
style: { width: '20%', float: 'left', marginLeft: '10px' },
10+
}, Img({ src: url, onClick: onClick, key: 'photo' + index}));
1011
});
1112

1213
return React.createElement('div', {

0 commit comments

Comments
 (0)