1.0.2 • Published 4 months ago

react-hooks-extension v1.0.2

Weekly downloads
-
License
ISC
Repository
github
Last release
4 months ago

react-hooks-extension Monthly download Total downloads

Install

npm install react-hooks-extension --save

Usage

import {useStateRef, useReducerRef, useDebounce, useStateDebounce} from 'react-hooks-extension';

const [state, setState, stateRef] = useStateRef('init value');
const [data, dataDispatch, dataRef] = useReducerRef((prevData, action) => {}, {data: 'init value'});
const delayFunction = useDebounce(
    useCallback(() => {
        // do something delay
    }, []),
    2000,
    useCallback(() => {
        // do something first
    }, []),
);
const [keywords, setKeywords, keywordsDelay, setKeywordsDelay] = useStateDebounce('', 2000);