use-ref-state

0.0.3 • Public • Published

use-ref-state

Copied from https://ryankubik.com/blog/use-ref-state/

Usage

const ComponentWithEvent = () => {
  const [state, stateRef, setState] = useRefState(0);
 
  useEffect(() => {
    setTimeout(() => {
      console.log(stateRef.current);
    }, 100);
  }, []);
 
  setState(1);
};

Readme

Keywords

none

Package Sidebar

Install

npm i use-ref-state

Weekly Downloads

1

Version

0.0.3

License

MIT

Unpacked Size

2.79 kB

Total Files

4

Last publish

Collaborators

  • tuckerconnelly