diff --git a/README.md b/README.md index 21a704b..38e4ea3 100644 --- a/README.md +++ b/README.md @@ -117,15 +117,24 @@ import Sortable from 'react-sortablejs'; class MySortableList extends React.Component { static propTypes = { + sortableInstance: React.PropTypes.object, items: React.PropTypes.array }; static defaultProps = { + sortableInstance: null items: [] }; state = { items: this.props.items }; + componentDidUpdate() { + // Note: The sortableInstance is null for the initial render + const { sortableInstance } = this.props; + + // You can see all the methods at https://github.com/RubaXa/Sortable#method + console.log(sortableInstance.toArray()); + } handleStart(evt) { // Dragging started } handleEnd(evt) { // Dragging ended