Skip to content

Commit 487d78b

Browse files
Merge pull request #43 from developerdizzle/InitialStateDocumentation
Updates documentation with initialState
2 parents f7444af + 72cf49f commit 487d78b

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,11 @@ Options are used before the virtualized component can be created. This means th
7373

7474
```js
7575
const options = {
76-
container: this.refs.container
76+
container: this.refs.container, // use this scrollable element as a container
77+
initialState: {
78+
firstItemIndex: 0, // show first ten items
79+
lastItemIndex: 9, // during initial render
80+
},
7781
};
7882

7983
const MyVirtualList = VirtualList(options)(MyList);
@@ -82,6 +86,7 @@ const MyVirtualList = VirtualList(options)(MyList);
8286
Name | Type | Default | Description
8387
--- | --- | --- | ---
8488
`container` | DOM Element | window | Scrollable element that contains the list. Use this if you have a list inside an element with `overflow: scroll`.
89+
`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.
8590

8691
#### Properties
8792

0 commit comments

Comments
 (0)