1

I know there is a lot of questions about React.memo().
But like I read before, there is no definitive rule about it. It depends of cases.
I read too, that React.memo could be worth when props changes often.

So inputs are a particular case for me. In a form, you have a state, with probably as much attributes as inputs. These inputs change often when you write on them (props change), but when you write in an other, it's preferable to keep it cached, because Form is rerendering. The rest of input props never change.

So should we use React memo to cache inputs ? Even if when you write on it, it should be faster as possible ?

Geo Daz
  • 214
  • 1
  • 11
  • Do you have a concrete example? Sounds like [premature optimization](https://stackify.com/premature-optimization-evil/), you don't need to "cache" inputs, they not rerender on same props, you might want to memo the component which renders them, but still you need make some checks beforehand – Dennis Vash Mar 30 '21 at 13:08
  • As for forms, you might want to try researching on [Uncontrolled Components](https://reactjs.org/docs/uncontrolled-components.html) – Dennis Vash Mar 30 '21 at 13:10

0 Answers0