Skip to content
/ damda Public

Damda is a state/actions container for Javascript client apps

Notifications You must be signed in to change notification settings

daesan/damda

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Damda

Damda is a state/actions container for Javascript client apps.

It simplifies react and react native app development by separating data management from view rendering codes.

Damda was inspired by Redux. While the core ideas of Redux are inherited, Damda differs from Redux in that actions and reducer functions are not separate entities. In Damda, actions are state change functions that can be dispatched directly.

Installation

To install the stable version:

npm install --save damda

The Gist

const { createStore, createActionGroup } = require('damda')

/**
 * This is action group definition.
 * Each action is a pure function with (state) => state signature.
 * 
 * The shape of the state can be a nested javascript object.
 */
const counter = createActionGroup({
  default: () => 0,
  increment: (state) => state+1,
  decrement: (state) => state-1
})

let store = createStore(counter)

// You can subscribe to state changes.
store.subscribe((state) => console.log(state))

// You can change internal state by dispatching actions.
store.dispatch(counter.increment)
// 1
store.dispatch(counter.increment)
// 2
store.dispatch(counter.decrement)
// 1

About

Damda is a state/actions container for Javascript client apps

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published