0.2.10 • Published 5 months ago
xeres v0.2.10
xeres
This is a React state manager.
- Out of the box.
- zero configuration.
- decentralized.
- freely combined.
Install
npm install xeres
Getting Started
// countStore.ts
import { defineStore } from 'xeres'
export default defineStore({
state: () => ({
name: 'world',
count: 0
}),
getters: {
welcome() {
return `Hello, ${this.name}`
}
},
actions: {
increment() {
this.count += 1
},
decrement() {
this.count -= 1
}
}
})
import countStore from './countStore'
const useCountStore = () => countStore.useSelector(store => ({
count: store.count,
welcome: store.welcome
}))
export function counter() {
/**
* // All state data changes respond.
* const { count, welcome } = countStore.useSelector()
*/
// just responds to changes in count and welcome.
const { count, welcome } = useCountStore()
return (
<div>
<h2>{welcome}</h2>
<div>
<button onClick={countStore.increment} >
Increment
</button>
<span>{count}</span>
<button onClick={countStore.decrement} >
Decrement
</button>
</div>
</div>
)
}
License
This project is licensed under the MIT License.
0.2.10
5 months ago
0.2.9
5 months ago
0.2.8
5 months ago
0.2.7
6 months ago
0.2.6
6 months ago
0.2.5
2 years ago
0.2.4
2 years ago
0.2.3
2 years ago
0.2.2
2 years ago
0.2.1
2 years ago
0.2.0
2 years ago
0.1.7
2 years ago
0.1.6
2 years ago
0.1.5
2 years ago
0.1.4
2 years ago
0.1.3
2 years ago
0.1.2
2 years ago
0.1.1
2 years ago
0.1.0
2 years ago