floppy-disk 3.0.0-beta.3 → 3.0.0-beta.4

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 +9 -12
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -7,6 +7,8 @@ FloppyDisk provides a very similar developer experience (DX), while introducing
7
7
 
8
8
  Comparison: https://github.com/afiiif/floppy-disk/tree/beta/comparison
9
9
 
10
+ Demo: https://afiiif.github.io/floppy-disk/
11
+
10
12
  **Installation:**
11
13
 
12
14
  ```
@@ -22,7 +24,7 @@ import { createStore } from 'floppy-disk/react';
22
24
 
23
25
  const useDigimon = createStore({
24
26
  age: 3,
25
- level: 'Rookie' as 'In-Training' | 'Rookie' | 'Champion' | 'Ultimate',
27
+ level: 'Rookie',
26
28
  });
27
29
  ```
28
30
 
@@ -52,18 +54,13 @@ function Control() {
52
54
  }
53
55
 
54
56
  // You can create a custom actions
55
- const evolve = (nextLevel: 'Rookie' | 'Champion' | 'Ultimate') => {
56
- const { age, level } = useDigimon.getState();
57
+ const evolve = () => {
58
+ const { level } = useDigimon.getState();
57
59
 
58
- const minAge = {
59
- Rookie: 3,
60
- Champion: 6,
61
- Ultimate: 11,
62
- };
60
+ const order = ['In-Training', 'Rookie', 'Champion', 'Ultimate'];
61
+ const nextLevel = order[order.indexOf(level) + 1];
63
62
 
64
- if (age < minAge[nextLevel]) {
65
- return console.warn('Not enough age');
66
- }
63
+ if (!nextLevel) return console.warn('Already at ultimate level');
67
64
 
68
65
  useDigimon.setState({ level: nextLevel });
69
66
  };
@@ -254,7 +251,7 @@ Each unique parameter creates its own cache entry.
254
251
  FloppyDisk does **not provide** a dedicated "infinite query" API.\
255
252
  Instead, it embraces a simpler and more flexible approach:
256
253
 
257
- > _Infinite queries are just **composition** + **recursion**._
254
+ > Infinite queries are just **composition** + **recursion**.
258
255
 
259
256
  Why? Because async state is already powerful enough:
260
257
 
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "floppy-disk",
3
3
  "description": "Lightweight, simple, and powerful state management library",
4
4
  "private": false,
5
- "version": "3.0.0-beta.3",
5
+ "version": "3.0.0-beta.4",
6
6
  "publishConfig": {
7
7
  "tag": "beta"
8
8
  },