Skip to content

kne-union/use-callback-state

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

useCallbackState

用于解决useState的setState的回调方法问题

npm i @kne/use-callback-state

Usage

1、组件引入npm

import callbackState from '@kne/use-callback-state';

2、应用

export default () => {
    const [count, setCount ] = callbackState('');
    const handleIncrease = () => {
        setCount(val => val + 1, (state) => {
            console.log(state);
        });
    };
    return (
        <button onClick={ handleIncrease }></button>
    )
}

About

用于解决useState的setState的回调方法问题

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published