Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/tuckerconnelly/use-ref-state


https://github.com/tuckerconnelly/use-ref-state

Last synced: 23 days ago
JSON representation

Awesome Lists containing this project

README

        

# use-ref-state

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

## Usage

```js
const ComponentWithEvent = () => {
const [state, stateRef, setState] = useRefState(0);

useEffect(() => {
setTimeout(() => {
console.log(stateRef.current);
}, 100);
}, []);

setState(1);
};
```