Amamori
Minimal Flux Framework.
Overview
Component is a class have utility to observe store event that inherits React view.
Dispatcher is just EventEmitter.
ActionCreator is just functions.
Store is just a class inherits EventEmitter.
API
Dispatcher and AppContextProvider
Dispatcher provides a context between Component relationship with parent and child, and flux elements. This is just a EventEmitter.
AppContextProvider is Container to pass the Dispatcher to child Components.
// example const Dispatcher = document
Component
Component extends React.Component.
You can declare the stores as static method names storeTypes
.
Every store will attach components state automatically.
You'll basically implement the logic to initialize on componentDidMount
. If you'd like to use componentWillMount
don't forget to call super function.
You might want to use loadingView
and view
method instead of render. loadingView
will called when declared stores in initializing.
// example static { return SomeNiceStore } { ActionCreator } { return <div>now loading...</div> } { return <div>thisstatesomenicegreet</div> }
Store
const NiceRecord = Immutable static { return NiceRecord } { }
ActionCreator
// writing