Browse Source

Merge pull request #406 from NSinopoli/master

Reset state when component receives new props
pull/408/head
Lebedev Konstantin 10 years ago
parent
commit
54fc87c035
  1. 10
      react-sortable-mixin.js

10
react-sortable-mixin.js vendored

@ -134,6 +134,16 @@
this._sortableInstance = Sortable.create((this.refs[options.ref] || this).getDOMNode(), copyOptions);
},
componentWillReceiveProps: function (nextProps) {
var newState = {},
modelName = _getModelName(this),
items;
if (items = nextProps[modelName]) {
newState[modelName] = items;
this.setState(newState);
}
},
componentWillUnmount: function () {
this._sortableInstance.destroy();

Loading…
Cancel
Save