npm.io
1.0.3 • Published 7 years ago

react-hooklib

Licence
ISC
Version
1.0.3
Deps
1
Size
35 kB
Vulns
0
Weekly
0

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.

Build Status NPM Version

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>
}
API

See API Document

Keywords