Posts

Showing posts from August, 2017

Redux, combineReducers and allowing slice reduces to access other parts of the state tree

If you need a redux reducer that adds some "injectables" as the third argument to the reducers normally combined in redux's combineReducers, try this one: /** * A combineReducers replacement that adds additional arguments * to the reduction call to inject different values a reducer * might need, read-only, from other parts of the tree. Reducer * order calling is not specified. If no injectables are provided * the overall state is included under the key "_root_". * * @param{Object}reducers Reducer object. Each key with a function is included in a final reducer. * @param{Object}injectables Key-Functions. All functions are called with the overall state and * current action. The results are attached to an object under their original keys. * Non-function values are ignored. * @param{string}rootName The name of the root that is attached if injectables is empty.*/exportfunctioncombineReducers(reducers, injectables, rootName="_root_") { constfinalRe…

Web app styling interlude: How to identify the key pieces of a styling solution

There are many ways to process "styles" for your web application. We can break down the key decisions about which processing approach to use based on a few design decisions. You can mix and match these approaches within the same app. For example, some of your components may be using one combination and another component, another approach. Themeing, always a hot topic, may use a variety of approaches as well as a good themeing engine can be quite complex to integrate into your application. By selecting the model you want to use from each of the areas below, you can then decide on a specific set of software to perform the processing. For example, if you want to author in js, apply at runtime using inline css, you could use glamor. Or if you want to use css, process them at build time but have them load through stylesheets, you can use css-loader and style-loader in webpack. Authoring Environment You can author CSS in CSSJS/JSXless/scss... There are many authoring environments. W…