Use enhancedDeepClone in a Custom LWC (Managed Package)

Use the enhancedDeepClone() utility function in your custom Lightning web component (LWC) to create a modifiable copy of read-only JavaScript objects. This function also supports copying objects created directly within your LWC, providing flexibility for your data manipulation tasks.

Required Editions

Available in: Lightning Experience
Available in: Enterprise, Unlimited, and Developer Editions
Required User Permissions
To configure Lightning web components: Communications Cloud Admin

Managed Package Icon This feature is part of the Communications Cloud managed package.

  1. Import enhancedDeepClone from the c/b2bUtils library.
    import enhancedDeepClone from 'c/b2bUtils';
  2. Call the function to create a modifiable copy of your read-only data.
    You can also use this function to copy objects created within your LWC.
    let newModifiableObject = enhancedDeepClone(readOnlyData);