react-lifecycle-decorators
0.2.2 • Public • Published Lifecycle decorators
Lifecycle decorators for stateless components
Installation
npm install -S react-lifecycle-decorators
componentWillMount(props)
const Component = ()=>(
<div/>
);
export default componentWillMount(props=>props.fetchData())(Component);
shouldComponentUpdate(nextProps, props)
const Component = ()=>(
<div/>
);
export default shouldComponentUpdate((nextProps, props)=>false)(Component);
componentWillUnmount(props)
const Component = ()=>(
<div/>
);
export default componentWillUnmount(props=>props.somAction())(Component);
componentWillReceiveProps(nextProps, props)
componentWillUpdate(nextProps, props)
componentDidUpdate(prevProps, props)
Package Sidebar
Install
npm i react-lifecycle-decorators
Weekly Downloads