Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rish-0-0/use-parallel-state
React use state hook which runs in a worker thread
https://github.com/rish-0-0/use-parallel-state
Last synced: about 16 hours ago
JSON representation
React use state hook which runs in a worker thread
- Host: GitHub
- URL: https://github.com/rish-0-0/use-parallel-state
- Owner: rish-0-0
- Created: 2021-09-04T20:51:26.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2021-09-07T20:23:18.000Z (about 3 years ago)
- Last Synced: 2023-03-07T13:12:50.642Z (over 1 year ago)
- Language: TypeScript
- Size: 42 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Use Parallel State
Runs a state container in a dedicated web worker.
## Global State
Yes, this can be used as a global state container which runs in a worker. One thing is you should know the id of the
reducer you're storing state through :)## Comlink
This package uses @surma blessing: Comlink. Super lightweight RPC implementation of self.postMessage
## Actor Model
The whole idea is to follow as close to the `useReducer` hook from React but it should run according to the Actor Model.
## State Management
If you call a `useParallelState` with an existing reducer's id, it will return the existing reducer's content.
## Buffering Updates
Comlink's internal engine is relied upon for this. The more frequent your updates, the more queueing up happens, and the more thread hops
there are. Shouldn't be too much of a problem, as this is a heavy reducer which takes time to do a state update.## Status
- In development
- Adding a deep json diff checker.
- Adding comprehensive tests