Last active
May 25, 2017 16:07
-
-
Save RomanHotsiy/c0fe09fdc86f2466aaa852ffc5d55652 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { graphql } from 'react-apollo'; | |
import { graphqlLodash } from 'graphql-lodash'; | |
export function gqlLodash(rawQuery, config) { | |
const {query, transform} = graphqlLodash(rawQuery); | |
// save original props callback | |
let origProps = (config && config.props) || ((props) => props); | |
return (comp) => graphql(query, {...config, | |
props: (props) => origProps({ | |
...props, | |
rawData: props.data, | |
data: transform(props.data) | |
}) | |
})(comp); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment