@aweary/reactive
v0.0.3
Published
A small utility for implementing naive reactivity for object fields.
Downloads
11
Readme
@aweary/reactive
A small utility for implementing naive reactivity for object fields.
import reactive from '@aweary/reactive'
const state = { name: "Jane" }
// After calling reactive with a source object, it will
// now automatically watch for all property changes
reactive(state, (key, value) => {
console.log(`${key} is now ${value}`)
})
// Changing a value invokes the observer function
state.name = "Jim"
// Logs "name is now Jim"