Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
inokawa committed Aug 29, 2023
1 parent fe827ba commit 9809d0e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,24 @@ And see [examples](./stories) for more usages.

### FAQs

#### Is there any way to improve performance?

Sometimes children element generation can be a performance bottle neck if you re-render frequently the parent of virtual scroller and the children are thousands of items, because React element generation is not free and new React element instance breaks some of memoization inside virtual scroller. In that case use useMemo to reduce computation and keep the elements's instance the same.

```tsx
const elements = useMemo(
() => array.map((d) => <Component key={d.id} {...d} />),
[array]
);
const [position, setPosition] = useState(0);
return (
<div>
<VList onScroll={(offset) => setPosition(offset)}>{elements}</VList>
<div>position: {position}</div>
</div>
);
```

#### What is `ResizeObserver loop completed with undelivered notifications.` error?

It may be dispatched by ResizeObserver in this lib [as described in spec](https://www.w3.org/TR/resize-observer/#deliver-resize-error). If it bothers you,
Expand Down

0 comments on commit 9809d0e

Please sign in to comment.