Skip to content

Commit

Permalink
Add blacklist docs for hoistStatics (acdlite#635)
Browse files Browse the repository at this point in the history
  • Loading branch information
pex authored and istarkov committed Mar 28, 2018
1 parent 7918e23 commit b3c743c
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion docs/API.md
Original file line number Diff line number Diff line change
Expand Up @@ -702,13 +702,22 @@ const ABC = nest(A, B, C)
### `hoistStatics()`
```js
hoistStatics(hoc: HigherOrderComponent): HigherOrderComponent
hoistStatics(
hoc: HigherOrderComponent,
blacklist: Object
): HigherOrderComponent
```
Augments a higher-order component so that when used, it copies non-react static properties from the base component to the new component. This is helpful when using Recompose with libraries like Relay.
Note that this only hoists _non-react_ statics. The following static properties will not be hoisted: `childContextTypes`, `contextTypes`, `defaultProps`, `displayName`, `getDefaultProps`, `mixins`, `propTypes`, and `type`. The following native static methods will also be ignored: `name`, `length`, `prototype`, `caller`, `arguments`, and `arity`.
You can exclude more static properties by passing them as `blacklist` object:
```js
hoistStatics(EnhancedComponent, { foo: true })(BaseComponent) // Exclude `foo`
```
## Observable utilities
It turns out that much of the React Component API can be expressed in terms of observables:
Expand Down

0 comments on commit b3c743c

Please sign in to comment.