Skip to content

Instantly share code, notes, and snippets.

@srph
Last active February 19, 2018 03:42
Show Gist options
  • Select an option

  • Save srph/0650fea00736c93137d0536ba3393010 to your computer and use it in GitHub Desktop.

Select an option

Save srph/0650fea00736c93137d0536ba3393010 to your computer and use it in GitHub Desktop.
import React, {Component} from 'react'
class Column extends Component {
state = {
list: [], // Let's pretend this is filled by some AJAX request
sorting: 0,
sorted: []
}
filter(sorting) {
switch(sorting) {
case 1:
//
case 2:
//
case 3:
//
default:
return this.state.list
}
}
render() {
return (
//
)
}
handleFilter(sorting) {
this.setState({
sorting,
sorted: this.filter(sorting)
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment