react-hooklib
v1.0.3
Published
Helpers working around React Hooks API
Downloads
7
Readme
react-hooklib
Helpers working around React Hooks API.
This lib want keep as helpers
, but not targeting a fullly Custom Hooks, it's targeting dev experience when building component based on React Hooks.
Install
You can install from NPM, or use files in lib
.
npm install --save react-hooklib
Usage
This lib require React 16.8.0 or later, since it's based on React Hooks API.
Each helper can be imported individually:
import {onDidMount, onWillUnmount} from 'react-hooklib';
function Hello(){
onDidMount(()=>{
console.log('component did mount!');
});
onWillUnmount(()=>{
console.log('component will unmount!');
});
return <div>Hello</div>
}