Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React performance issue rendering of thousands of components

Tags:

reactjs

We have a small react application where we have a page where we render very large xml in the collapsible tree format.

XML is about 10k Lines. We have various components for xml opening, closing tags, body and attributes and so on. This is read only xml view with only option to collapse and expand xml tags. This takes about 6-7 seconds to render.

Is there any way to speed this up?

like image 374
ashishjmeshram Avatar asked Nov 24 '25 23:11

ashishjmeshram


1 Answers

  1. Load the components only which you need (react loadable / dynamic imports and React.lazy)
  2. Re-render only those parts which you need to (React.memo with useMemo() and useCallback())
  3. Before fixing re-renders, fix slow renders
  4. Render only parts visible in windows(react window)
like image 187
Shivam Jha Avatar answered Nov 26 '25 14:11

Shivam Jha



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!