1.0.2 • Published 8 years ago

async-update-props v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

async-update-props

NPM version Build Status Test coverage Dependency Status

Async props update HoC for React Component

Install

$ npm install async-update-props

Usage

import { compose } from 'redux';
import { connect } from 'react-redux';
import asyncUpdateProps from 'async-update-props';

import Page from '../components/Page';
import { fetchDataRequest } from '../actions';


const mapStateToProps = (state) => ({
  ...
});

const updater = (props) => {
  props.fetchDataRequest();
};

const shouldUpdateWhenReceiveProps = () => false;


export default compose(
  connect(mapStateToProps, {
    fetchDataRequest,
  }),
  asyncUpdateProps(updater, shouldUpdateWhenReceiveProps)
)(Page);

API

asyncUpdateProps(updater, shouldUpdateWhenReceiveProps)

updater

Required Type: func

shouldUpdateWhenReceiveProps

Optional Type: func Default: () => true

License

MIT © Yoctol

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago