Last active
April 16, 2018 00:52
-
-
Save theKashey/fc2af683030aa125aa2b600b17179706 to your computer and use it in GitHub Desktop.
Table + MemoizedFlow
This file contains 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
// base - https://github.com/reactjs/rfcs/pull/40#discussion_r180818891 | |
import {MemoizedFlow} from "react-memoize"; | |
class Example { | |
getSortedData = (list, sortFn) => list.slice().sort(sortFn) | |
getPagedData = (list, page) => list.slice(page*10, (page+1)*10)) | |
render() { | |
return ( | |
<MemoizedFlow | |
input={this.props} | |
flow = [ | |
({data, sort}) => ({ data: this.getSortedData(data, sort)}), | |
({data, page}) => ({ data: this.getPagedData(sorted, page)}); | |
] | |
> | |
{ ({data}) => /* Render with this.props, this.state, and derived values ..*/ } | |
</MemoizedFlow> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment