Skip to content

Commit

Permalink
give redux-subscriber some attention in StoreSetup.md (reduxjs#2433)
Browse files Browse the repository at this point in the history
It has both technical scalability and a good level of documentation. It took me a while to find it, so I hope this can change things for future readers.
  • Loading branch information
William Bernting authored and timdorr committed May 31, 2017
1 parent 8b3e0cb commit bf2b9b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/faq/StoreSetup.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ This chain of middleware is defined by the arguments passed to the `applyMiddlew

Redux provides a single `store.subscribe` method for notifying listeners that the store has updated. Listener callbacks do not receive the current state as an argument—it is simply an indication that *something* has changed. The subscriber logic can then call `getState()` to get the current state value.

This API is intended as a low-level primitive with no dependencies or complications, and can be used to build higher-level subscription logic. UI bindings such as React Redux can create a subscription for each connected component. It is also possible to write functions that can intelligently compare the old state vs the new state, and execute additional logic if certain pieces have changed. Examples include [redux-watch](https://github.com/jprichardson/redux-watch) and [redux-subscribe](https://github.com/ashaffer/redux-subscribe) which offer different approaches to specifying subscriptions and handling changes.
This API is intended as a low-level primitive with no dependencies or complications, and can be used to build higher-level subscription logic. UI bindings such as React Redux can create a subscription for each connected component. It is also possible to write functions that can intelligently compare the old state vs the new state, and execute additional logic if certain pieces have changed. Examples include [redux-watch](https://github.com/jprichardson/redux-watch), [redux-subscribe](https://github.com/ashaffer/redux-subscribe) and [redux-subscriber](https://github.com/ivantsov/redux-subscriber) which offer different approaches to specifying subscriptions and handling changes.

The new state is not passed to the listeners in order to simplify implementing store enhancers such as the Redux DevTools. In addition, subscribers are intended to react to the state value itself, not the action. Middleware can be used if the action is important and needs to be handled specifically.

Expand All @@ -80,4 +80,4 @@ The new state is not passed to the listeners in order to simplify implementing s
- [#1300: Redux is great but major feature is missing](https://github.com/reactjs/redux/issues/1300)

**Libraries**
- [Redux Addons Catalog: Store Change Subscriptions](https://github.com/markerikson/redux-ecosystem-links/blob/master/store.md#store-change-subscriptions)
- [Redux Addons Catalog: Store Change Subscriptions](https://github.com/markerikson/redux-ecosystem-links/blob/master/store.md#store-change-subscriptions)

0 comments on commit bf2b9b5

Please sign in to comment.