Skip to content

Risto-Stevcev/callbag-store

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

callbag-store

Build Status Latest release License

A callbag implementation of a redux-like store

npm install callbag-store

example

const {createStore} = require('callbag-store')
const observe = require('callbag-observe')

const { dispatch, store } = createStore((state, action) => {
  switch (action.type) {
    case 'SET_FOOBAR':
      return { foobar: state.foobar + action.foobar }
    default:
      return state
  }
}, { foobar: 1 })

observe(console.log)(store)

dispatch({ type: 'SET_FOOBAR', foobar: 3 })
dispatch({ type: 'SET_FOOBAR', foobar: 7 })

About

A callbag implementation of a redux-like store

Resources

License

Stars

Watchers

Forks

Packages

No packages published