1
1
## Backset
2
2
3
- An ** easy to use ** React state management tool .
3
+ A minimalist state tool for React apps .
4
4
5
5
- Very few APIs.
6
6
- Based on React Hooks and Context.
7
7
- Tracking and eliminate unnecessary re-renders.
8
8
- No redundant template code.
9
- - Nothing to learn.
9
+ - Gzipped ≈ ` 1.5kb ` .
10
+
11
+ <br />
12
+
13
+ ### Easy to use
14
+
15
+ - ` backset ` is based on ` React.Context ` .
16
+ - ` backset ` is designed to let you write less code.
17
+
18
+ This is the simplest implementation of count under ` backset ` and ` React.Context ` ,
19
+ Obviously, ** ` backset ` is shorter and easier to read** , if you have multiple components or pass more values,
20
+ the advantage of ` backset ` will be more obvious.
21
+
22
+ You also can see their differences in the [ codesandbox editor] ( https://codesandbox.io/s/backset-vs-context-zi7vd?file=/src/native-context.jsx ) .
23
+
24
+ <p align =" center " >
25
+ <b >Count example with <code >backset</code ></b >
26
+ </p >
27
+ <p align =" center " >
28
+ <img align =" center " width =" 620 " src =" https://user-images.githubusercontent.com/11304944/83858617-59dafc00-a74f-11ea-82b3-de2e46c8173a.png " >
29
+ </p >
30
+ <p align =" center " >
31
+ <b >Count example with Native Context</b >
32
+ </p >
33
+ <p align =" center " >
34
+ <img align =" center " width =" 620 " src =" https://user-images.githubusercontent.com/11304944/83858624-5ba4bf80-a74f-11ea-84f0-bede9be1ad3d.png " >
35
+ </p >
36
+
37
+ <br />
38
+
39
+ ### Performance & Optimization
40
+
41
+ We all know that the native React.Context will [ render repeatedly] ( https://github.com/facebook/react/issues/15156#issuecomment-474590693 ) ,
42
+ unless you use the ` React.Memo ` wrap component or the ` useMemo ` wrap render function, this requires a lot of repetitive code.
43
+
44
+ You don't have to think about these problems when using ` backset ` , it provides the ` useTracked ` API to automatically track state,
45
+ this means:
46
+
47
+ - Better performance without changing any code.
48
+ - Still ` hooks ` , still your favorite style.
49
+ - Switch at any time, no duplicate code.
50
+
51
+ ** Click to [ view this example online] ( https://codesandbox.io/s/backset-tracked-f3vrw?file=/src/app.js ) .**
52
+
53
+ <p align =" center " >
54
+ <b >Automatically avoids unnecessary rendering</b >
55
+ </p >
56
+ <p align =" center " >
57
+ <img align =" center " width =" 620 " src =" https://user-images.githubusercontent.com/11304944/83864332-31570000-a757-11ea-9d9b-defcf2decdfd.png " >
58
+ </p >
59
+
60
+ <br />
61
+
62
+ ### Experience & API Design
63
+
64
+ Although ` backset ` looks magical, it doesn't make any hacks.
65
+
66
+ ` backset ` can intelligently provide all types of inference, it can even check your properties by type,
67
+ Using ` backset ` in your project is definitely a pleasure!
68
+
69
+ <p align =" center " >
70
+ <b >Automatically tips and constraints</b >
71
+ </p >
72
+ <p align =" center " >
73
+ <img align =" center " width =" 620 " src =" https://user-images.githubusercontent.com/11304944/83866702-c4de0000-a75a-11ea-947f-0da90e88751c.png " >
74
+ </p >
10
75
11
76
12
77
### Quick start
@@ -33,10 +98,14 @@ export default withContext(App)
33
98
34
99
[ Edit this example on codesandbox] ( https://codesandbox.io/s/backset-quick-start-xj1p9?file=/src/index.js ) .
35
100
101
+ <br />
102
+
36
103
### Documentation
37
104
38
105
- [ Document Site] ( https://backset.now.sh )
39
106
107
+ <br />
108
+
40
109
### LICENSE
41
110
42
111
[ MIT] ( https://github.com/unix/backset/blob/master/LICENSE )
0 commit comments