D
D
Dmitry2021-01-20 17:48:19
React
Dmitry, 2021-01-20 17:48:19

What is the common practice for using component memoization in React?

Let's say I have such a part inside the component

<div>
  {items.map(item => <Item item={item}>)}
</div>


and the given array items contains a large number of elements.

Does it make sense to memoize this div, provided that there are no expensive calculations in the Item component? That is, if React receives a memoized jsx with a div tag and a couple of hundred nested Items, will it check the existing div in the DOM for the attributes of all children to match, or just leave everything as it is, since the jsx reference itself has not changed?

I hope I explained clearly

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question