react-redux-rp

1.0.0 • Public • Published

react-redux-rp

The awesome, declarative render props version of connect

NPM JavaScript Style Guide

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 storedefault 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

Readme

Keywords

none

Package Sidebar

Install

npm i react-redux-rp

Weekly Downloads

0

Version

1.0.0

License

MIT

Unpacked Size

52.8 kB

Total Files

4

Last publish

Collaborators

  • xjkit