September 2018
Intermediate to advanced
302 pages
7h 17m
English
When I was first introduced to this concept, I started to scratch my head. How is it any faster? If you want to modify an object, you need to clone it and this is a serious cost with any simple change. I thought it was unacceptable. I assumed it was the same cost as if we were performing equality check on every level. I was both right and wrong.
It depends on the tools you use. Special data structures, such as Immutable.js, make numerous optimizations to work easily. However, if you clone your objects with the spread operator or Object.assign(), then you recreate the whole object again or unknowingly just clone one level deep.
Read now
Unlock full access