Replies: 1 comment
-
Wow, this looks interesting... I have a big request for this feature. It would be super nice to pass a Map for initial data. import { proxyMap } from 'valtio/utils'
const key1 = {}
const key2 = {}
const state = proxy({
map: proxyMap(new Map([[key1, 'a']])),
})
state.map.set(key2, 'b') We should also support non-string keys anyway, because that's the purpose of Map. There will be more to consider. We would need lots of tests. Anyway, I'm excited! |
Beta Was this translation helpful? Give feedback.
-
Hey, I use an abstraction layer to mimic Set and Map with Valtio.
I was wondering if you think it's worth it to add that to the library. In that case, I could prepare a PR :). Otherwise, I can publish a library and mention it in the wiki. WDYT?
Thank you
Beta Was this translation helpful? Give feedback.
All reactions