Skip to content

Instantly share code, notes, and snippets.

@bryceosterhaus
Created December 7, 2018 22:48
Show Gist options
  • Save bryceosterhaus/b374109aa10d0c90c7573e37d9585702 to your computer and use it in GitHub Desktop.
Save bryceosterhaus/b374109aa10d0c90c7573e37d9585702 to your computer and use it in GitHub Desktop.
Row {
handleMoveDown() {
this.props.onChange(this.props.index, -1);
}
handleMoveUp() {
this.props.onChange(this.props.index, 1);
}
}
Group {
handleReorder(index, numOfRows) {
const newRowOrder = [...this.state.rows];
// Manipulate newRowOrder here to move it +/- rows
return newRowOrder
}
render() {
return <div>
{this.state.rows.map((item, i) => <Row index={i} onChange={this.handleReorder} />)}
</div>
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment