reduxify
Enhances the react-redux/connect function for simple cases.
Installation:
npm install --save reduxify
API:
reduxify({[state], [selector], [actions]})
Arguments
-
[
state
] (String): A String corresponding to the name of a top-level branch of the app state tree. -
[
selector
] (function): A function mapping state to props. A memoized selector function describing specific selection logic. The selector efficiently computes derived data from the store. Using Reselect is recommended. If specified, the selector mapping will override thestate
parameter. -
[
actions
] (Object): An object containing actions.
Returns
(function): An enhanced connect
function for use on a React component class.
Example
{ const mySubState actions = props return <MyComponent prop1= mySubStatevalue1 prop2= mySubStatevalue2 action1= actionsaction1 action2= actionsaction2 /> } state: 'mySubState' actions: action1 action2 MyContainer//=====================
Notes for 1.0.1
This package no longer depends on Lodash.
This package now supports custom props passed in as a fourth parameter.
This package is backwards compatable with 1.0.0, and can be dropped in as a replacement.
Notes for 1.0.2
Jonathan Sun contacted Brian Boyko and pointed out he had done very similar work, as such, he and Brian are now listed as co-contributors.
Notes for 1.0.3
Simplify reduxify.
- Specify either a top-level app substate or supply a selector function.
- Supply actions as an object of actions instead of array
- Remove
component
andoptionalMethods
parameters