Skip to content

Commit 3a123c1

Browse files
authored
improve store description
1 parent c741f04 commit 3a123c1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,8 @@ The only requirement for function - **Should have zero or one argument**
242242
**Store** is an object that holds the state tree. There can be multiple stores.
243243

244244
```js
245-
// `getUsers` - is a effect
246-
// `addUser` - is a event
245+
// `getUsers` - is an effect
246+
// `addUser` - is an event
247247
const defaultState = [{ name: Joe }];
248248
const users = createStore(defaultState)
249249
// subscribe store reducers to events
@@ -252,14 +252,14 @@ const users = createStore(defaultState)
252252

253253
// subscribe side-effects
254254
const callback = (newState) => console.log(newState)
255-
users.watch(callback) // `.watch` for a store is triggered immidiatly: `[{ name: Joe }]`
256-
// the `callback` will triggered each time when `.on` handler returns new state
255+
users.watch(callback) // `.watch` for a store is triggered immediately: `[{ name: Joe }]`
256+
// `callback` will be triggered each time when `.on` handler returns the new state
257257
```
258258

259259
Most profit thing of stores is their compositions:
260260

261261
```js
262-
// `.map` accept state of parent store and return new memoized store
262+
// `.map` accept state of parent store and return new memoized store. No more reselect ;)
263263
const firstUser = users.map(list => list[0]);
264264
firstUser.watch(newState => console.log(`first user name: ${newState.name}`)) // "first user name: Joe"
265265

0 commit comments

Comments
 (0)