88
99> A tiny ~ 650b centralized state container with component bindings for [ Preact] & [ React] .
1010
11- - ** Small** footprint complements Preact nicely
12- - ** Familiar** names and ideas from Redux-like libraries
13- - ** Useful** data selectors to extract properties from state
14- - ** Portable** actions can be moved into a common place and imported
15- - ** Functional** actions are just reducers
16- - ** NEW** : seamlessly run Unistore in a worker via [ Stockroom] ( https://github.com/developit/stockroom )
11+ - ** Small** footprint complements Preact nicely
12+ - ** Familiar** names and ideas from Redux-like libraries
13+ - ** Useful** data selectors to extract properties from state
14+ - ** Portable** actions can be moved into a common place and imported
15+ - ** Functional** actions are just reducers
16+ - ** NEW** : seamlessly run Unistore in a worker via [ Stockroom] ( https://github.com/developit/stockroom )
1717
1818## Table of Contents
1919
20- - [ Install] ( #install )
21- - [ Usage] ( #usage )
22- - [ Examples] ( #examples )
23- - [ API] ( #api )
24- - [ License] ( #license )
20+ - [ Install] ( #install )
21+ - [ Usage] ( #usage )
22+ - [ Examples] ( #examples )
23+ - [ API] ( #api )
24+ - [ License] ( #license )
2525
2626## Install
2727
@@ -69,10 +69,10 @@ You can find the library on `window.unistore`.
6969import createStore from ' unistore'
7070import { Provider , connect } from ' unistore/preact'
7171
72- let store = createStore ({ count: 0 })
72+ const store = createStore ({ count: 0 })
7373
7474// If actions is a function, it gets passed the store:
75- let actions = store => ({
75+ const actions = store => ({
7676 // Actions can just return a state update:
7777 increment (state ) {
7878 return { count: state .count + 1 }
@@ -90,7 +90,7 @@ let actions = store => ({
9090
9191 // Async actions can be pure async/promise functions:
9292 async getStuff (state ) {
93- let res = await fetch (' /foo.json' )
93+ const res = await fetch (' /foo.json' )
9494 return { stuff: await res .json () }
9595 },
9696
@@ -126,8 +126,8 @@ Make sure to have [Redux devtools extension](https://github.com/zalmoxisus/redux
126126import createStore from ' unistore'
127127import devtools from ' unistore/devtools'
128128
129- let initialState = { count: 0 };
130- let store = process .env .NODE_ENV === ' production' ? createStore (initialState) : devtools (createStore (initialState));
129+ const initialState = { count: 0 };
130+ const store = process .env .NODE_ENV === ' production' ? createStore (initialState) : devtools (createStore (initialState));
131131
132132// ...
133133```
@@ -150,4 +150,5 @@ If not, just open a [new clear and descriptive issue](../../issues/new).
150150[ MIT License] ( https://oss.ninja/mit/developit ) © [ Jason Miller] ( https://jasonformat.com )
151151
152152[ preact ] : https://github.com/developit/preact
153+
153154[ react ] : https://github.com/facebook/react
0 commit comments