react-lifecycle-hoc

Higher-order components of react lifecycle.

Usage no npm install needed!

<script type="module">
  import reactLifecycleHoc from 'https://cdn.skypack.dev/react-lifecycle-hoc';
</script>

README

react-lifecycle-hoc

Higher-order components of react lifecycle.

Travis Codecov Status npm package npm downloads license

Dependency Status devDependency Status peerDependency Status

Installation

$ npm install react-lifecycle-hoc --save

Usage

  • As HOC
import { componentDidMount } from 'react-lifecycle-hoc';

componentDidMount(
  ({ props }) => console.log(props),
)(() => <div/>);
  • ES7 decorator
@componentDidMount(callback)
class Container extends React.Component {
  render() {
    return <div/>;
  }
}

API

componentDidMount(
  callback: (this: Object) => void,
): HigherOrderComponent

Test

$ npm run lint
$ npm run test:watch

CONTRIBUTING

  • ⇄ Pull requests and ★ Stars are always welcome.
  • For bugs and feature requests, please create an issue.
  • Pull requests must be accompanied by passing automated tests ($ npm test).

CHANGELOG

LICENSE

MIT: http://michaelhsu.mit-license.org