Skip to content

Commit 4e79284

Browse files
committed
Docs updates
1 parent 09777cc commit 4e79284

File tree

3 files changed

+9
-11
lines changed

3 files changed

+9
-11
lines changed

CHANGELOG.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ We've made some changes to make observable selectors more convenient. None of th
1616

1717
### Added `component.isMounted()` API
1818

19-
As we roll out increased support for dynamic mounting, knowing whether or not a component is currently mounted becomes increasingly relevant. In previous versions this could be checked by looking for the `__mounted` internal variable on the component instance (which is now deprecated)
20-
2119
There is now a `component.isMounted()` API which returns true when the component is mounted and false otherwise.
2220

2321
## 0.3.0

docs/API/mountComponent.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,11 @@
22

33
## State tree design
44

5-
Broadly speaking, there are two ways to manage your Redux state tree using redux-components. You can let redux-components manage the root of your tree (as well as all subnodes) or your state tree can be managed manually, with redux-components being mounted at one or more subnodes of the state tree.
5+
Broadly speaking, there are two ways to manage your Redux state tree using redux-components. You can let redux-components manage the root of your tree, or your state tree can be managed manually, with redux-components being mounted at one or more subnodes of the state tree.
66

7-
We discuss both of these cases.
7+
Note that even if you let redux-components manage your root node, you can still attach any reducer you want, including reducers from external libraries, to nodes beneath your root node. For ease of use, we recommend letting redux-components manage your root node.
8+
9+
We discuss both cases below.
810

911
### redux-component at the root
1012

@@ -37,7 +39,7 @@ store = createStore( (x) -> x )
3739
mountRootComponent(store, rootComponent)
3840
```
3941

40-
> * When using this approach, you can still attach reducers not managed by redux-components to nodes of your state tree beneath the root. Use `SubtreeMixin`.
42+
> * When using this approach, you can still attach reducers not managed by redux-components to nodes of your state tree beneath the root. Use `SubtreeMixin` or `redux-components-map`.
4143
4244
### Manual mounting
4345

docs/Advanced/ObservableSelector.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ Redux 3.6.x adds the ability for Stores to function as [ES7 Observables](https:/
44

55
## Functionality
66

7-
Observable selectors are provided by adding the `ObservableSelectorMixin` to your component class:
7+
When declaring a class, any functions specified under the `selectors` key will automatically be converted into ES7 Observables:
8+
89
```coffeescript
9-
{ ObservableSelectorMixin, createClass } = require 'redux-components'
10+
{ createClass } = require 'redux-components'
1011

1112
MyClass = createClass {
12-
mixins: [ ObservableSelectorMixin ]
1313
...
1414
selectors: {
1515
mySelector: (state) -> state.myValue
@@ -18,8 +18,6 @@ MyClass = createClass {
1818
}
1919
```
2020

21-
Behind the scenes, this mixin ensures that when an instance of your component is mounted, all of the `selectors` on the instance will be augmented to conform to the [ES7 Observable](https://github.com/tc39/proposal-observable) pattern.
22-
2321
Here are the details:
2422

2523
- To watch an observable selector for changes, you call the `subscribe(Observer)` method on the selector, passing an object that conforms to the ES7 `Observer` interface. The `subscribe` method returns an ES7 `Subscription` object that can be used to unsubscribe later.
@@ -37,4 +35,4 @@ subscription.unsubscribe()
3735

3836
- Observable selectors assume conformance with the Redux contract, and therefore use identity (`===`) comparison to detect changes. Your Redux stores are expected to return unequal objects when changes are made.
3937

40-
- Your component must be mounted to a store before you may subscribe to observable selectors. (This means, inter alia, that while inside a component's `componentWillMount` method, you cannot observe the selectors of that component. You must wait until `componentDidMount`.)
38+
- Selectors are only active when a component is mounted. You may still attach an `Observer` to a selector even when a component is not mounted, but the `Observer` will not be attached until it is.

0 commit comments

Comments
 (0)