Skip to content

Some useful hooks combinations. Such as useRef & useState => useStateRef and more.

Notifications You must be signed in to change notification settings

booyeu/react-hooks-extension

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);

About

Some useful hooks combinations. Such as useRef & useState => useStateRef and more.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published