DEV Community

Discussion on: 📖 History of "Stop unnecessary re-rendering component in React !!"

Collapse
 
thuutri2710 profile image
Tris
Thread Thread
 
jorge_rockr profile image
Jorge Ramón

Thanks, exactly what I said but remember primitives are immutable so that why they act as "pass-by-value"

Thread Thread
 
thuutri2710 profile image
Tris

Oh, let me confirm again. In JS, we only "pass-by-value"

Thread Thread
 
jorge_rockr profile image
Jorge Ramón

Okay, I got your point.

Technically, JS works "pass-by-value" since you pass a copy of a reference. But if you modify that copy of the reference then it modifies the original object so that's basically "pass-by-reference" xd

Same as Primitive Data Types Immutability is basically the same as pass-by-value.

So it depends, you can see the glass half empty or half full

Thread Thread
 
thuutri2710 profile image
Tris

Agree with you