There are a couple of things to consider:
- render cost of a large list
- updating an item
For #1 you can try using a windowing library such as react-virtualized, this will make the burden on the DOM much lighter, instead of rendering thousands of items, you will actually be rendering only a few tens.
For #2 make sure that when an item updates, only that items updates and not the list. You can use memo to ensure your list items are only renders again when their props change.
I was in the same boat and solved my problem a different way, by implementing the
shouldComponentUpdate lifecycle method in my component:
This is perhaps a better overall solution, because:
- it's easier to implement (i.e.: don't have to wrap your existing component in a
- it's supported even on older versions of React that don't have "memo" (i.e.: versions older than 16.6.0, which was released in 2018)
- How to handle the render of a large list of items in react?
- How to handle onKeyDown/Up opening the list items in React
- How to render "N items selected" rather than the list of N selected items with react-select
- How to render a list by date while grouping the items with the same date in a div
- How do I apply CSS transitions (e.g. fade-ins) to a list of items in React so their animations are sequenced one after the other on render?
- How to reduce render time while rendering huge list of items in Ionic React
- How to render and add similar item to the list of items from the api in React.js?
- How to handle uncaughtException in react and render a simple "internal bug" message to the UI?
- How to take items from an array that is in a React component's props and render to the page?
- Mapping over X items in React and then conditionally render for items that were not in the list
- How can I scan through the list of string array items to identify which part matches regex expression for url and convert it to link w react typescri
- How to click a button into a list array items only effect the related item using React hooks
- How to render two react list groups in the same container, chronologically
- How to get the data from React Context Consumer outside the render
- How does webpack handle multiple files importing the same module React
- How to pass the match when using render in Route component from react router (v4)
- How to avoid re-rendering the whole List instead of adding the new item to the DOM list in react JS?
- How to get the marquee effect with list view in react native?
- How to handle exit app in one screen not in the whole app - React Native?
- How to render JSON response as dropdown list in React
- React Router V4: How to render a modal in the same screen changing only the url and then with that url, be able to rebuild the whole screen
- How to handle list items in Redux
- How to fast render >10000 items using React + Flux?
- How to dynamically show/hide a list of items in react
- In React and Material-UI how do I make my Grid items take up 100% of available horizontal space w/o wrapping to the next row?
- React - How to return one of several components in the render function?
- how to create list of Years in the dropdown using react js JSX
- How to have different style for items at certain locations in a list in React Native?
- How could I use map to render a list of items but grouped at every 3 items?
- How to Separate Jsx inside render function into a separate file in ES6? or any other solution in react to separate the Logic and presentation?
More Query from same tag
- Why is removing an item from a list with the key as index working as expected?
- Cannot read property 'setState' of undefined at handleupload
- How to render component only once in React Native
- How do I apply a Font Theme in React Material-UI?
- how index is working in a function using react
- express body-parser returns empty body in req object
- Is there any way to update only one cell record in MongoDB using nodes and express js?
- JestJS: How to test for state value on catch()
- How to increase the specificity of a class of props?
- get particular job details based on jobId in redux and router
- useEffect is trigged unexpectedly
- How to configure node live server? I'm getting rollbackFailedOptionalerror
- How to navigate to a path that is not declared in App.js
- Disable prettier for a single file
- Displaying list dynamically in react when user click on input filed
- how to make filter work on column its values are array of object in MUIDataTable?
- How to imperatively assign a prop to a React component?
- Importing a module, error with library functions
- unable to get previous date using moment.js
- Change the color of an Ionic Component In React
- Fontsize Change for Cell in Material UI Table
- window.innerWidth in real time
- Immutable JS - How to replace a list with a new list
- React Map function not rendering on browser, but it is console.logging
- Trying to pass a redux action as prop to a child component
- React Typescript distinguish between different prop types, choosing from one of two types
- Multiple Markers are not rendered in React Leaflet Map
- Typescript complains about a property not being there but it is there
- Is there a valid way to use redux with react without react-redux?
- React - How to update the state in useEffect without causing an infinite loop?