๐Ÿ“Œย ๋ฐฐ๊ฒฝ

<aside> ๐Ÿ“Œ

4์ค„ ์š”์•ฝ

  1. react-windowing์„ ๊ตฌํ˜„ํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” react-window์™€ virtualization๋ผ์ด๋ธŒ๋Ÿฌ๋ฆฌ๋ฅผ ํ†ตํ•ด List์™€ Gridํ˜•ํƒœ๋กœ ๊ตฌํ˜„ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค.
  2. AutoSizer์™€ InfiniteLoader๋กœ react-window์˜ px, ๋ฌดํ•œ์Šคํฌ๋กค ๋‹จ์ ์„ ๋ณด์™„ํ•ฉ๋‹ˆ๋‹ค.
  3. InfiniteLoader๋ฅผ ์‚ฌ์šฉํ•  ๋•Œ๋Š” List์—์„œ๋Š” ์ž˜ ์ž‘๋™ํ•˜์ง€๋งŒ, Grid๋Š” ์ถ”๊ฐ€๊ตฌํ˜„์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค.
  4. windowing, RN์€ ๊ธฐ๋ณธ์ ์œผ๋กœ ์ง€์›ํ•ด์ฃผ์ง€๋งŒ, ์›น์—์„œ๋Š” ์•Œ์•„์„œ ๊ตฌํ˜„ํ•ด์•ผ ํ•ฉ๋‹ˆ๋‹ค. (ํ•˜์ง€๋งŒ, CSS์˜ content-visibility๊ฐ€ ์žˆ๋‹ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค!) </aside>

๐Ÿงชย ์ ์šฉํ•˜๊ธฐ

import { FixedSizeList as List } from 'react-window';

import './styles.css';

const Row = ({ index, style }) => (
  <div className={index % 2 ? 'ListItemOdd' : 'ListItemEven'} style={style}>
    Row {index}
  </div>
);

const Example = () => (
  <List
    className="List"
    height={150}
    itemCount={1000}
    itemSize={35}
    width={300}
  >
    {Row}
  </List>
);

๋ Œ๋”๋ง ํ…Œ์ŠคํŠธ(98% ๊ฐœ์„ )