Skip to main content
Module

x/valtio/docs/utils/proxySet.mdx

πŸ’Š Valtio makes proxy-state simple for React and Vanilla
Go to Latest
File
---title: 'proxySet'section: 'Utils'description: ''---
# proxySet
#### `proxySet` util
This utility creates a proxy which mimics the native Set behavior. The API is the same as the native Set API.
```jsimport { proxySet } from 'valtio/utils'
const state = proxySet([1,2,3])
state.add(4)state.delete(1)state.forEach(v => console.log(v)) // ---> 2,3,4```
It can be used inside a `proxy` as well.
```jsimport { proxySet } from 'valtio/utils'
const state = proxy({ count: 1, set: proxySet()})```