bvaughn / react-window

React components for efficiently rendering large lists and tabular data
https://react-window.now.sh/
MIT License
15.54k stars 779 forks source link

hook API for existing components #717

Open Am1rArsalan opened 1 year ago

Am1rArsalan commented 1 year ago

Hi,

Since react-window is the most loved package and mostly is being used in projects, I was wondering if we could have the hooks API for existing components that we have right now. Is there any plan for that?

example:

import { useFixedSizeList  } from 'react-window';

const Example = () => { 
  const { items }  = useFixedSizeList({ 
        height: 150,
        itemCount: 1000,
        itemSize: 35,
        width: 300,
   });

 return (  
    <div>
      {items.map((virtualRow) => { 
           return (
               <div style={style}>Row {virtualRow.index}</div> 
           ) 
      })
    </div>
   ) 
};
SepehrGouran commented 1 year ago

Take a look at this headless library https://tanstack.com/virtual/v3

Am1rArsalan commented 1 year ago

https://tanstack.com/virtual/v3 is still in beta, and my suggestion was to have hook APIs for the react-window package.