0

Current if I want to update the value of a store, I would do

const store = useStore({ a: 100, b: 100 })
store.a = 200 // change the value by using store.xxx
store.b = 200

Is there a way I can pass a whole object without writing out the code manually?

// For example, some magic function update
store.update({ a: 200, b:200 })

Currently, I am using Object.keys() to loop through each key of the object to update the value but I dont think it's a good (clean) solution.

Sam
  • 3
  • 2

0 Answers0