'useMemo' is used in this situation.
Let's think about a situation.
There is Component A which have part A.
It takes a long time to render part A.
Component A will be rerendered, but part A will not change.
In this situation, if we can save previous part A somewhere and use only the result without calculating (This happens only if there is no change in part A), the rendering time will be shortened a lot.
Below is the example.