@aweary/reactive

0.0.3 • Public • Published

@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"

/@aweary/reactive/

    Package Sidebar

    Install

    npm i @aweary/reactive

    Weekly Downloads

    5

    Version

    0.0.3

    License

    MIT

    Last publish

    Collaborators

    • aweary