r/reactjs•
skyboyer007

is _.cloneDeep a code smell?

Discussion

I know, I know, Immer is not just better for memory consumption, but also may be up to 250x times faster on large data set. But currently no way for me to introduce it to existing legacy code base. Let's assume immer is a winner and let's talk about 2nd and 3rd places :)

So question: for small objects(memory overhead is not an issue) would you prefer old-school shallow copy { ..., [..., sometimes multilevel? or _.cloneDeep + mutation? Any specific reason? Or gut feeling?

Posted Feb 23, 2023, 12:18 AM UTC

412
Loading comments…