M
M
miliko mikoyan2019-07-07 17:44:47
React
miliko mikoyan, 2019-07-07 17:44:47

If props is missing Should memo be used?

I have this component

import React, { Fragment, memo } from "react";

const Gurdingo = () => {
  return <Fragment>100</Fragment>;
};

export default memo(Gurdingo);

Do I need to use memo here.
or react itself understands that it is not necessary to rebuild component Gurdingo.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Spirin, 2019-07-09
@miliko0022

In this case, instead of re-rendering, you will always get the memorized result of the first one. In some cases, this can improve performance.

R
Robur, 2019-07-07
@Robur

I already gave the correct answer here: Do I need to use useMemo in hooks?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question