Skip to content

Commit 69e569c

Browse files
authored
Add installation and simple example
1 parent 3ddcb75 commit 69e569c

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

README.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,34 @@ ReactSmartScroll is a lightweight, high-performance, easy-to-use way to render l
66

77
ReactSmartScroll is un-opinionated, with minimum configuration. It has automatic support for variable height rows, even if they change height at runtime due to resizing, expanding, etc.
88

9-
Working Demo with variable height rows:
9+
### Installation
10+
```
11+
yarn add react-smart-scroll
12+
13+
npm install --save react-smart-scroll
14+
```
15+
16+
### Super Simple Sample:
17+
```javascript
18+
import ReactSmartScroll from 'react-smart-scroll';
19+
20+
const data = [
21+
{id: 1, text: 'Hello'},
22+
{id: 2, text: 'World'},
23+
];
24+
25+
const TestRow = ({data, rowRef}) => (
26+
<div ref={rowRef}>
27+
{data.text}
28+
</div>
29+
);
30+
31+
export default () => (
32+
<ReactSmartScroll data={data} row={TestRow} />
33+
);
34+
```
35+
36+
### Working Demo with variable height rows:
1037
https://codesandbox.io/s/react-smart-scroll-demo-3x1ym
1138

1239
**This component uses React Hooks, so it requires React 16.8.x or above.**

0 commit comments

Comments
 (0)