Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/itstoreall/signal-state
Signal State
https://github.com/itstoreall/signal-state
createcontext effect preact react signals vitejs
Last synced: 10 days ago
JSON representation
Signal State
- Host: GitHub
- URL: https://github.com/itstoreall/signal-state
- Owner: itstoreall
- Created: 2024-01-08T15:27:30.000Z (12 months ago)
- Default Branch: main
- Last Pushed: 2024-01-28T15:07:24.000Z (11 months ago)
- Last Synced: 2024-11-02T14:42:00.349Z (about 2 months ago)
- Topics: createcontext, effect, preact, react, signals, vitejs
- Language: TypeScript
- Homepage:
- Size: 78.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Signal State
The State with GlobalContext [GitHub branch](https://github.com/itstoreall/signal-state/tree/backup-multi-state-globalcontext)
The State without GlobalContext [GitHub branch](https://github.com/itstoreall/signal-state/tree/backup-state-without-global-context)
--
### How to use:
- Add a new state config in the states/index.ts
- Add a new type of the state in the states/types.ts
- Add this new type to the CustomType in the states/types.ts--
_Primitive values:_
```
import state from '../signalState';const stateNameValue = state.stateName.get();
state.stateName.set(value, delay)
state.stateName.isStore
```_Value is an object:_
```
import \* as types from '../signalState/states/types';const stateNameValue = state.third.get() as types.StateName;
return
{`Name: ${stateNameValue.name}`};
```