Deep copying objects using JSON.stringify and JSON.parse
January 13, 2021 — There are a lot of reasons where you would want to “deep copy” objects in your application. For instance, when working with React.js, you might have used the shouldComponentUpdate
life-cycle method. In this method, you would determine if the component has the same props and state as it had previously by shallow or deep copying objects.