react-checkbox-group
Advanced tools
Comparing version
{ | ||
"name": "react-checkbox-group", | ||
"version": "3.1.1", | ||
"version": "3.2.0", | ||
"description": "Sensible checkbox groups manipulation for DOM.", | ||
@@ -5,0 +5,0 @@ "main": "react-checkbox-group.js", |
@@ -160,3 +160,3 @@ 'use strict'; | ||
if (typeof this.props.onChange === 'function') { | ||
this.props.onChange(newValue, event); | ||
this.props.onChange(newValue, event, this.props.name); | ||
} | ||
@@ -163,0 +163,0 @@ } |
@@ -119,5 +119,5 @@ import React, {Component} from 'react'; | ||
if (typeof this.props.onChange === 'function') { | ||
this.props.onChange(newValue, event); | ||
this.props.onChange(newValue, event, this.props.name); | ||
} | ||
} | ||
} |
@@ -73,19 +73,20 @@ # [React](http://facebook.github.io/react/)-checkbox-group | ||
```javascript | ||
var Demo = React.createClass({ | ||
getInitialState: function() { | ||
return { | ||
class Demo extends React.Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
fruits: ['apple','watermelon'] | ||
}; | ||
}, | ||
} | ||
componentDidMount: function() { | ||
componentDidMount() { | ||
// Add orange and remove watermelon after 5 seconds | ||
setTimeout(function() { | ||
setTimeout(() => { | ||
this.setState({ | ||
value: ['apple','orange'] | ||
fruits: ['apple','orange'] | ||
}); | ||
}.bind(this), 5000); | ||
}, | ||
}, 5000); | ||
} | ||
render: function() { | ||
render() { | ||
// the checkboxes can be arbitrarily deep. They will always be fetched and | ||
@@ -104,4 +105,5 @@ // attached the `name` attribute correctly. `value` is optional | ||
); | ||
}, | ||
fruitsChanged: function(newFruits) { | ||
} | ||
fruitsChanged = (newFruits) => { | ||
this.setState({ | ||
@@ -111,3 +113,4 @@ fruits: newFruits | ||
} | ||
}); | ||
}; | ||
@@ -114,0 +117,0 @@ ReactDOM.render(<Demo/>, document.body); |
20633
0.09%120
2.56%