1. API
  2. unstable_deepProxy

deepProxy

You can use this utility to recursively go through an object and proxy all proxiable objects with the exception of anything marked with ref(). Maps will become proxyMaps and Sets will become proxySets.

import { deepProxy, isProxyMap, isProxySet } from 'valtio/utils'

const obj = {
  mySet: new Set(),
  myMap: new Map(),
  sub: {
    foo: 'bar',
  },
}

const clonedProxy = deepProxy(obj)

console.log(isProxyMap(clonedProxy.myMap)) // true
console.log(isProxySet(clonedProxy.mySet)) // true