stora
A stand-alone model-update library.
npm install stora
Component
A component is a piece of state that represents a model.
const todos = state update
State
A function that returns a value.
const state = list: text: ''
Update
An object that contains functions to apply over your state.
const update = list: statelist text: statetext text: text
Store
A store contains components.
const store = const app =
State
Returns a value from a component's state.
app//=> []
Update
Calls an update from a component, with a payload.
app//=> { list: [ 'hello' ], text: '' } app//=> [ 'hello' ]
Subscribe
Every time an update occurs, the function passed to subscribe will be called.
appapp//=> { type: 'todos/add', payload: 'again' } { list: [ 'hello' ], text: '' } { list: [ 'hello', 'again' ] }