Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Amended comments on connectToStores #246

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 12 additions & 9 deletions src/addons/reactComponentMethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,19 @@ export default React => {

/**
* Connect component to stores, get the combined initial state, and
* subscribe to future changes. There are three ways to call it. The
* simplest is to pass a single store key and, optionally, a state getter.
* The state getter is a function that takes the store as a parameter and
* returns the state that should be passed to the component's `setState()`.
* If no state getter is specified, the default getter is used, which simply
* returns the entire store state.
* subscribe to future changes.
*
* There are three ways to call it.
*
* The simplest is to pass a single store key and, optionally, a state
* getter. The state getter is a function that takes the store as a
* parameter and returns the state that should be passed to the component's
* `setState()`. If no state getter is specified, the default getter is
* used, which simply returns the entire store state.
*
* The second form accepts an array of store keys. With this form, the state
* getter is called once with an array of store instances (in the same order
* as the store keys). the default getter performance a reduce on the entire
* as the store keys). the default getter performs a reduce on the entire
* state for each store.
*
* The last form accepts an object of store keys mapped to state getters. As
Expand All @@ -116,8 +119,8 @@ export default React => {
*
* Returns the combined initial state of all specified stores.
*
* This way you can write all the initialization and update logic in a single
* location, without having to mess with adding/removing listeners.
* With this you can write all the initialization and update logic in a
* single location, without having to mess with adding/removing listeners.
*
* @type {string|array|object} stateGetterMap - map of keys to getters
* @returns {object} Combined initial state of stores
Expand Down