Skip to content

Commit

Permalink
Merge pull request #43 from developerdizzle/InitialStateDocumentation
Browse files Browse the repository at this point in the history
Updates documentation with initialState
  • Loading branch information
developerdizzle authored Feb 24, 2017
2 parents f7444af + 72cf49f commit 487d78b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,11 @@ Options are used before the virtualized component can be created. This means th

```js
const options = {
container: this.refs.container
container: this.refs.container, // use this scrollable element as a container
initialState: {
firstItemIndex: 0, // show first ten items
lastItemIndex: 9, // during initial render
},
};

const MyVirtualList = VirtualList(options)(MyList);
Expand All @@ -82,6 +86,7 @@ const MyVirtualList = VirtualList(options)(MyList);
Name | Type | Default | Description
--- | --- | --- | ---
`container` | DOM Element | window | Scrollable element that contains the list. Use this if you have a list inside an element with `overflow: scroll`.
`initialState` | object | - | An object with `firstItemIndex` and `lastItemIndex` properties, which represent array indexes of `items` (see below). These are used to calculate the visible items before the component is mounted. Useful for server-side rendering.

#### Properties

Expand Down

0 comments on commit 487d78b

Please sign in to comment.