@poool/junipero-hooks
v2.1.0
Published
π Junipero Design System React hooks
Downloads
102
Keywords
Readme

Installation
yarn add @poool/junipero-hooksUsage
import React from 'react';
import { useEventListener, useTimeout } from '@poool/junipero-hooks';
export default () => {
useTimeout(() => {
console.log('This has been executed 1s after first render!');
}, 1000);
useEventListener('click', () => {
console.log('You clicked inside the current document');
});
return <div />;
};Documentation
useEventListener(name: String, handler: Function, target: DOMNode)
name{String} Event namehandler{Function}event{Object} Event data
target{DOMNode} Custom event target (default:global)
useTimeout(handler: Function, time: Number, changes: Array)
handler{Function} Timeout callbacktime{Number} Time in ms before timeoutchanges{Array} Reset timer when any value changes (just likeuseEffect)
Contributing
Please check the CONTRIBUTING.md doc for contribution guidelines.
License
This software is licensed under MIT.
