{"library":"nl-flux","title":"nl-flux","description":"An ES6 Flux library for ReactJS, providing a Flux dispatcher and Store base class with an immutable state tree. Version 1.1.10 (latest stable) includes core Flux and Store exports, plus sessionStorage helpers. The library emphasizes an Action-on-Store pattern with Immutable.js state management, offering event listeners on store updates. Requires Immutable.js as a peer dependency. Compared to alternatives like Redux, nl-flux is more opinionated and tightly coupled with Immutable.js, making it suitable for projects already using Immutable. Releases appear infrequent; check for compatibility with newer React versions.","language":"javascript","status":"active","last_verified":"Fri May 01","install":{"commands":["npm install nl-flux"],"cli":null},"imports":["import { Flux } from 'nl-flux'","import { Store } from 'nl-flux'","import * as NLFlux from 'nl-flux'"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import { Flux, Store } from 'nl-flux';\nimport { Map } from 'immutable';\n\nclass AppStore extends Store {\n  initialState() {\n    return { count: 0 };\n  }\n\n  onAction(type, data, state) {\n    switch (type) {\n      case 'INCREMENT':\n        return state.update('count', v => v + 1);\n      default:\n        return state;\n    }\n  }\n}\n\nconst store = Flux.registerStore(AppStore);\n\nFlux.dispatch({ type: 'INCREMENT' });\nconsole.log(Flux.getStore('AppStore').toJS()); // { count: 1 }","lang":"javascript","description":"Demonstrates creating a Store with initial state, handling actions via onAction, registering with Flux, dispatching an action, and reading the immutable state tree.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}