There is no downside in that as long as you are certain what the object you're spreading into the component looks like. In this case, it's easy to start passing things that the component doesn't even need, and introduce unnecessary rerenders.
That it would, yep. Also think about the contract of you component, so to say.
I think you are adding an additional, not necessary layer in the middle, the reading patterns of the code would be as following:
Component usage -> Wrapper Object definition -> Value definition
vs
Component usage -> Value definition
I am usually reluctant to bring in any indirection if it doesn't have great value to add to the code.
My 2 cents,
Ale
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
There is no downside in that as long as you are certain what the object you're spreading into the component looks like. In this case, it's easy to start passing things that the component doesn't even need, and introduce unnecessary rerenders.
So for example, if a component only needs A and B but C is also given, and if C is changed, it wil rerender?
Exactly! Even if the component doesn't use that prop at all, it will still rerender.
That it would, yep. Also think about the contract of you component, so to say.
I think you are adding an additional, not necessary layer in the middle, the reading patterns of the code would be as following:
Component usage -> Wrapper Object definition -> Value definition
vs
Component usage -> Value definition
I am usually reluctant to bring in any indirection if it doesn't have great value to add to the code.
My 2 cents,
Ale