1.0.0 • Published 6 years ago

react-redux-rp v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
6 years ago

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

1.0.0

6 years ago