1.0.0 • Published 7 years ago

async-connect v1.0.0

Weekly downloads
2
License
ISC
Repository
github
Last release
7 years ago

async-conncect

npm travis standard

Install

yarn add async-conncect 

Usage

import { compose } from 'recompact'
import asyncConnect from 'async-conncect'
import { connect } from 'react-redux'

const enhance = compose(
  // this will call getUser and getOtherThing on componentDidMount as long as it's corresponding status isnt pending, success or failure.
  asyncConnect([
    {
      type: '@@my-app/getUser',
      action: getUser,
      payload: {
        id: 123
      }
    },
    {
      type: '@@my-app/getOtherThing',
      action: getOtherThing,
      payload: {
        id: 456
      }
    }
  ]),
  // you'll need to map the response of your action, thunk, saga (er, whatever) in your app's state reducer.
  connect(({ user }) => ({ user }))
)

export default enhance(props => props.user.name

Contributing

Contributions welcome! Please read the contributing guidelines first.

License

ISC

1.0.0

7 years ago

0.0.9

7 years ago

0.0.8

7 years ago

0.0.7

7 years ago

0.0.6

7 years ago

0.0.5

7 years ago

0.0.1

7 years ago