You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+18-1Lines changed: 18 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -112,11 +112,28 @@ Using the convenience helper function `middleware`:
112
112
113
113
__Create a store__
114
114
```
115
-
val store = createThreadSafeStore(reducer, AppState(user, listOf()), applyMiddleware(loggingMiddleware))
115
+
val store = createStore(reducer, AppState(user, listOf()), applyMiddleware(loggingMiddleware))
116
116
```
117
117
118
118
You then will have access to dispatch and subscribe functions from the `store`.
119
119
120
+
__Create a synchronized store__
121
+
```
122
+
val store = createThreadSafeStore(reducer, AppState(user, listOf()), applyMiddleware(loggingMiddleware))
123
+
```
124
+
125
+
Access to `store` methods like `dispatch` and `getState` will be synchronized. Note: if using a thread safe store with enhancers or middleware that require access to store methods, see usage below.
126
+
127
+
__Create a synchronized store using an enhancer__
128
+
```
129
+
val store = createStore(reducer, AppState(user, listOf(), compose(
createSynchronizedStoreEnhancer() // needs to be placed after enhancers that requires synchronized store methods
132
+
))
133
+
```
134
+
135
+
Access to `store` methods like `dispatch` and `getState` will be synchronized, and enhancers (eg. `applyMiddleware`) that are placed above `createSynchronizedStoreEnhancer` in the enhancer composition chain will receive the synchronized store.
136
+
120
137
## Communication
121
138
Want to give feedback, contribute, or ask questions?
0 commit comments