Reduxion
Reduxion is another take on redux that combines elements of flux for clarity and convenience including a global dispatcher for actions. It also makes use of ES6 features including inheritence and class notation for reducers.
Dependencies
Reduxion requires Node.js >= 4.3.2
API
Reduxion is written in ES6 and requires babel for transpilation. The API is identical to redux with a few exceptions (e.g you can't add middleware). You can import the following modules from the npm package:
;
See a live demo of the example included.
Action
An action is a function wrapper that calls the provided callback and implicitly emits an event when the callback terminates.
;// Performs an action.const MyAction =;;
When added to a store, reducers with functions named MyAction
will be called with data returned from the action.
Reducer
Reducers inherit from the Reducer
class and include functions that match an action type string.
;const INITIAL_STATE = {};{supername INITIAL_STATE;}// Reducer function to handle myAction.{// Magic goes herethis;}
Store
The store combines reducers into one state object that a component subscribes to for updates.
;;// Create the app reducers.const reducer = 'myReducerName';// Create a new store with all of the reducers.;
The state of the store is a collection of reducer states namespaced by the reducer's name. For example, myStore.getState()
would return an object with the key myReducerName
mapping to MyReducer
's state.
License
Licensed under the MIT License