Skip to content

About

a simple observable data & react hooks

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

kltk Observable

a simple observable data

Installtion

npm install kltk-observable

Usage

  1. import with esm

    import { observable } from 'kltk-observable';
  2. create a observable

    const initial = {};
    const store = observable(initial);
  3. subscribe/unsubscribe observable state changes

    const listener = (state) => {
      console.log('store changed', state);
    };
    
    const unsubscribe = store.subscribe(listener);
    
    setTimeout(() => {
      // unsubscribe with subscribe return 
      unsubscribe();
    
      // unsubscribe with store
      // store.unsubscribe(listener);
    });

About

a simple observable data & react hooks

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages