Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nicolasparada/js-store
Store
https://github.com/nicolasparada/js-store
npm-package state-management store
Last synced: 6 days ago
JSON representation
Store
- Host: GitHub
- URL: https://github.com/nicolasparada/js-store
- Owner: nicolasparada
- License: isc
- Created: 2019-02-21T22:26:47.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-03-23T00:53:33.000Z (over 1 year ago)
- Last Synced: 2024-04-14T07:10:36.262Z (7 months ago)
- Topics: npm-package, state-management, store
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# JavaScript Store
Simple state container for your daily use in 400 bytes 😊
Shipped like an ES module. Load it with ``.
## Example
```js
import { createStore } from 'https://unpkg.com/@nicolasparada/[email protected]/store.js'const store = createStore(0)
console.log('initial count:', store.getState())
const unsubscribe = store.subscribe(count => {
console.log('current count:', count)
})store.setState(1) // Set to 1.
store.setState(c => c + 1) // Increment current value.
```