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

https://github.com/termosa/create-global-state-hook

Creates a hook like useState but all instances will have a single shared storage
https://github.com/termosa/create-global-state-hook

Last synced: 12 months ago
JSON representation

Creates a hook like useState but all instances will have a single shared storage

Awesome Lists containing this project

README

          

# crete-global-state-hook

Creates a hook like useState but all instances will have a single shared storage

## Example

```js
import creteGlobalStateHook from 'crete-global-state-hook'

const useGlobalCounter = createGlobalStateHook(0)

export default function GlobalCounter() {
const [count, setCount] = useGlobalCounter()
return (


setCount(count - 1)} />
{count}
setCount(count + 1)} />

)
}
```