cross-state 0.10.1 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +6 -47
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,63 +1,22 @@
1
- [![npm badge](https://badgen.net/npm/v/schummar-state)](https://www.npmjs.com/package/schummar-state)
2
- [![bundlephobia badge](https://badgen.net/bundlephobia/minzip/schummar-state)](https://bundlephobia.com/result?p=schummar-state)
1
+ ![npm badge](https://img.shields.io/npm/v/cross-state)
2
+ [![bundlejs badge](https://deno.bundlejs.com/?badge&q=cross-state)](https://bundlejs.com/?q=cross-state)
3
3
 
4
- Lighweight React hooks based state library.
5
- Heavily inspired by [pullstate](https://github.com/lostpebble/pullstate)
4
+ State library for frontend and backend. With React bindings.
6
5
 
7
6
  # Getting started
8
7
 
9
8
  ### Install
10
9
 
11
10
  ```
12
- npm install schummar-state
11
+ npm install cross-state
13
12
  ```
14
13
 
15
14
  ### Create a store
16
15
 
17
16
  ```ts
18
- import { Store } from 'cross-state';
17
+ import { createStore } from 'cross-state';
19
18
 
20
- export const store = new Store({
19
+ export const store = createStore({
21
20
  counter: 0,
22
21
  });
23
22
  ```
24
-
25
- You can easily use multiple stores in parallel.
26
-
27
- ### Use store in a component
28
-
29
- ```tsx
30
- import store from './store';
31
-
32
- export function App() {
33
- const counter = store.useState((state) => state.counter);
34
-
35
- return (
36
- <div>
37
- <div>Counter: {counter}</div>
38
- </div>
39
- );
40
- }
41
- ```
42
-
43
- ### Update a store
44
-
45
- ```tsx
46
- import store from './store';
47
-
48
- export function App() {
49
- const counter = store.useState((state) => state.counter);
50
-
51
- const increment = () =>
52
- store.update((state) => {
53
- state.counter++;
54
- });
55
-
56
- return (
57
- <div>
58
- <div>Counter: {counter}</div>
59
- <button onClick={increment}>Increment</button>
60
- </div>
61
- );
62
- }
63
- ```
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "cross-state",
3
- "version": "0.10.1",
3
+ "version": "0.11.0",
4
4
  "description": "(React) state library",
5
5
  "license": "ISC",
6
- "repository": "schummar/schummar-state",
6
+ "repository": "schummar/cross-state",
7
7
  "author": {
8
8
  "name": "Marco Schumacher",
9
9
  "email": "marco@schumacher.dev"