---
title: "Comment by GAURAV BURANDE on \"Updating objects in a State. How not to use spread operator.\" | Hashnode"
description: "A dumb way to copy an object is using the spread operator. Instead use JSON.parse(JSON.stringify(object)) or JS has a new global function for cloning, checkout"
url: "https://hashnode.com/posts/updating-objects-in-a-state-how-not-to-use-spread-operator/64808d8a837566372d407d58/comment/6481a448ad7b6e44730b7dfd"
---

[Discussion](https://hashnode.com/posts/updating-objects-in-a-state-how-not-to-use-spread-operator/64808d8a837566372d407d58)

Comment [Updating objects in a State. How not to use spread operator.](https://hashnode.com/posts/updating-objects-in-a-state-how-not-to-use-spread-operator/64808d8a837566372d407d58)

[GAURAV BURANDE](https://hashnode.com/@gauravvan)

[Jun 8, 2023](https://hashnode.com/posts/updating-objects-in-a-state-how-not-to-use-spread-operator/64808d8a837566372d407d58/comment/6481a448ad7b6e44730b7dfd)

A dumb way to copy an object is using the spread operator.

Instead use JSON.parse(JSON.stringify(object)) or JS has a new global function for cloning, checkout structuredClone() **[developer.mozilla.org/en-US/docs/Web/API/structur…](https://developer.mozilla.org/en-US/docs/Web/API/structuredClone)**
