react-redux-rp
v1.0.0
Published
The awesome, declarative render props version of connect
Downloads
3
Readme
react-redux-rp
The awesome, declarative render props version of connect
Install
npm install --save react-redux-rp
Usage
import { Connected } from 'react-redux-rp';
// Function as a child component
<Connected stateKey="count" actionCreators={actionCreators}>
{({ state, actions }) => (
<Fragment>
<div>count: {state}</div>
<button onClick={actions.increment}>+</button>
<button onClick={actions.decrement}>-</button>
</Fragment>
);
}
</Connected>;
// or you can use render props
<Connected
stateKey="count" // get specific state from the store; default equals the entire store.
actionCreators={actionCreators} // auto bind action creators with dispatch.
render={({ state, actions }) => (
<Fragment>
<div>count: {state}</div>
<button onClick={actions.increment}>+</button>
<button onClick={actions.decrement}>-</button>
</Fragment>
)}
/>
License
MIT © xJkit