TLDR Web Dev · QUICK LINKS
SHALLOW CLONES VERSUS STRUCTURED CLONES
Summary from the TLDR Web Dev newsletter
When creating deep copies of nested JavaScript objects, using `structuredClone` instead of shallow cloning methods like the spread operator (`...`) prevents unexpected state mutations by verifying that all nested objects and arrays are duplicated, not just referenced.