My only issue with it is that it doesn't recursively merge. It's fine for flat objects. I use this pattern pretty often at work, sometimes in conjunction with lodash.
For instance, I use Objection for ORM and it has "computed properties" that need to be accessed in order to get the value, they're not serialized when doing toJSON so I often resort to:
You can also use mutlple sources in the RHS of a spead expression to get a merge
do you mean like this?
My only issue with it is that it doesn't recursively merge. It's fine for flat objects. I use this pattern pretty often at work, sometimes in conjunction with lodash.
For instance, I use Objection for ORM and it has "computed properties" that need to be accessed in order to get the value, they're not serialized when doing
toJSON
so I often resort to:EDIT Totally forgot, this is a pretty common pattern in Redux!
Completely agree. Its shallow like Object.assign. I was just say is an alternative to it really.