bvaughn / react-window

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

Where should I place the code for async fetch/axios data for the <List>? #685

Closed yelnyafacee closed 1 month ago

yelnyafacee commented 1 year ago

I checked all the sandboxes for react-window (react-virtualized-auto-sizer, react-window-infinite-loader)

They both use mock data

Where should I place the code for async fetch/axios data for the <List>?

SachinJadeja commented 1 year ago

Given the requirement, you can perform the Axios fetch in useEffect and on .then() store it inside a state.

leo1104 commented 1 year ago

Make the API call in a separate use effect and store the fetched data in a state, after that pass the data to ItemData in the list component.