DEV Community

[Comment from a deleted post]
Collapse
 
dance2die profile image
Sung M. Kim • Edited

Last week, there was a similar question on Reddit.

Passing props by spreading? Bad or doesn't matter? Saw some people say it can cause performance issues

My reply was

  1. It breaks encapsulation - Child component doesn't have to know about all props.
  2. It harms readability - Picking props makes it more intentional or what are you passing down?.
  3. It can break child component - Depending on where you spread, it can override child props.
  4. It breaks with ref - If child component doesn't use forwardRef, ref isn't passed down.
  5. It's lazy.

And also according to Awnry_Abe's reply

It also lets you slip invalid props past TS.