srsas
v0.1.2
Published
Synchronous reactive store and state
Downloads
3
Readme
SRSAS
S ynchronizing | R eactive | S tore | A nd | S tate
How and why
The goal of this project is to create a unified state management system, that can either be used in front-end frameworks as a state or a store. It also should optionally be persistent and synchronizing across multiple clients.
Main Functionality
- To serve as a minimal database (store) on the client side
- To serve as a state manager for front-end frameworks
- Optionally persistent
- Optionally synchronizing to a remote database and other clients
- Reactive store and state (changes automatically reflected on the front-end framework components).
Main objectives:
- Ease of use with least amount of overhead
- Compatibility with
- Multiple front-end frameworks
- Multiple clients (browsers, react-native ...etc)
- Multiple servers (serverless, CF workers ...etc)
- Fast and performant
- Lightweight
Installation
npm install srsas
Usage
Basic usage as a state manager
import * as React from "react"
import { Observable, observer } from "srsas"
// define state
const state = new Observable({
clicks: 0
}).target;
@observer // decorate class
class MyComponent extends React.Component {
render() {
<button
onClick={()=>state.clicks++}
>
clicked: {state.clicked}
</button>
}
}