Use an ES6 class in ListView docs

Reviewed By: mkonicek

Differential Revision:
D3723141
Ninja: docs only

fbshipit-source-id: e1030f85b524777d2efbedb3cf78c218c34bad88
This commit is contained in:
Martin Konicek 2016-08-16 09:48:13 -07:00 committed by Facebook Github Bot 9
parent fc5bed8693
commit 700574fe76
1 changed files with 17 additions and 14 deletions

View File

@ -65,21 +65,24 @@ var DEFAULT_SCROLL_CALLBACK_THROTTLE = 50;
* Minimal example:
*
* ```
* getInitialState: function() {
* var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
* return {
* class MyComponent extends Component {
* constructor() {
* super();
* const ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2});
* this.state = {
* dataSource: ds.cloneWithRows(['row 1', 'row 2']),
* };
* },
* }
*
* render: function() {
* render() {
* return (
* <ListView
* dataSource={this.state.dataSource}
* renderRow={(rowData) => <Text>{rowData}</Text>}
* />
* );
* },
* }
* }
* ```
*
* ListView also supports more advanced features, including sections with sticky