Skip to content

Instantly share code, notes, and snippets.

@alejandrosobko
Last active November 19, 2018 15:21
Show Gist options
  • Save alejandrosobko/8d678e98ff5cecbc51a34ff8653561e5 to your computer and use it in GitHub Desktop.
Save alejandrosobko/8d678e98ff5cecbc51a34ff8653561e5 to your computer and use it in GitHub Desktop.
class NumbersGame extends React.Component<any, INumbersGameState>{
public constructor(props: any) {
super(props);
this.onDragEnd = this.onDragEnd.bind(this);
this.state = {...initialData};
}
public onDragEnd(result: any) {
// the item was dropped!
}
public render() {
const numbers = this.state.column.numberIds.map((numberId: string) => this.state.numbers[numberId]);
return (
<NumbersGameContext onDragEnd={this.onDragEnd}>
<VerticalColumn column={this.state.column} items={numbers} />
</NumbersGameContext>
)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment