DEV Community

Discussion on: The pitfalls 🕳️ of cloning objects in JS (with Object.assign & object spread)

Collapse
 
mikgross profile image
Mikael

You can also use a library called 'lodash'. It has a .cloneDeep() method that does exactly that.

import * as _ from {'lodash'};

const clone = _.cloneDeep(clonedObject)