DEV Community

Discussion on: Deep vs Shallow Copy - with Examples

Collapse
mattdevio profile image
Matt G • Edited on

Using JSON.stringify / parse to deep clone objects can get you into trouble with certain data types. Use a library for deep cloning like lodash clonedeep. There is a good Stack Overflow post on this here

Collapse
laurieontech profile image
Laurie Author

You're correct! But for the examples I put in the post it's a good option. Nice to have these additional links as well.

Collapse
dinsmoredesign profile image
Derek D

Indeed. Stringify causes all kinds off problems with Dates.