eVisit
Redux with templates, brought to you byA Redux wrapper module that allows you to build out your redux store using templates.
Table of contents
Install
npm install --save redux-panoptic
About
Have you ever found yourself wading through file after file after file... through actions... through reducers, just wanting to make a simple update to your redux
store? You want to make that simple update, but you have to modify an action, AND a reducer... or possibly more than one. Why does redux
need to be so complicated and messy? Well, it doesn't! With redux-panoptic
your redux
store is built using a plain-object template (WYSIWYG style). Any static values are created in the template are automatically added to the redux
store with a default state, and actions to update, set, and reset. The template can be deeply nested, or you can create custom reducers (but need not create actions for this reducer... these are created automatically for you). redux-panoptic
also has the concept of "multi-dispatch", meaning you can update multiple parts of the store in a single "dispatch". See the magic at work below!
Usage
Simply specify a template for your store, and build the store:
// Run: `npm run example` ; // Create some middleware to help us log dispatchesvar { console; return ;}; // _actionNameAlias = give the ACTIONS for the template an alias for this key name // Create our store templatevar myTemplate = staticValues: boolean: true string: 'Hello world' number: 5 //This alias makes our actions such: store.actions.(reset|set|update)StaticValuesDEEPHello) deeperObject: // Create our own custom reducer // Notice how arguments are passed to the reducer exactly as they are passed to the action creator todos: ; // Build the redux store using our templatevar store = ;console; // Update the storestore;console; // Update a single value, using the action created (note the alias)store;console; // Update multiple values at the same timestore;console; // Reset the storestore;store;console;
More
For more information please see the WIKI