🚀 Big News:Socket Has Acquired Secure Annex.Learn More →
Socket
Book a DemoSign in
Socket

async-connect

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

async-connect

HOC for calling and statusing redux actions on componentDidMount

latest
Source
npmnpm
Version
1.0.0
Version published
Weekly downloads
8
-61.9%
Maintainers
1
Weekly downloads
 
Created
Source

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

Keywords

async

FAQs

Package last updated on 09 Nov 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts