File tree Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Expand file tree Collapse file tree 2 files changed +22
-0
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,17 @@ a utility belt for higher-order components in `apollo`. Recompose utilities for
44
55## Higher-order components
66
7+ ### ` withQueryData() `
8+
9+ ``` js
10+ withQueryData (
11+ queryDocument: DocumentNode,
12+ optionsObject: { options : (props ) => { variables } } | { options: Object }
13+ ): HigherOrderComponent
14+ ```
15+
16+ Same functionality as ` react-apollo ` ` graphql ` HOC, except the ` data ` prop or named data prop is flattened.
17+
718### ` withSubscribe() `
819
920``` js
Original file line number Diff line number Diff line change 1+ import { compose , flattenProp } from 'recompose' ;
2+ import { graphql } from 'react-apollo' ;
3+
4+ export default function withQueryData ( queryDocument , optionsObject = { } ) {
5+ const flattenKey = ( optionsObject && optionsObject . name ) || 'data' ;
6+
7+ return compose (
8+ graphql ( queryDocument , optionsObject ) ,
9+ flattenProp ( flattenKey )
10+ ) ;
11+ }
You can’t perform that action at this time.
0 commit comments