Last active
February 19, 2018 03:42
-
-
Save srph/0650fea00736c93137d0536ba3393010 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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