Created
December 3, 2017 20:11
-
-
Save drejohnson/31a9b474cfd93233a930cdba9a8a400b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
type hoc = ReasonReact.reactClass => ReasonReact.reactClass; | |
[@bs.module "react-apollo"] external graphql : GraphQLTag.definitions => hoc = "graphql"; | |
module type Query = {type data; let query: GraphQLTag.definitions;}; | |
module CreateWrapper = (Query: Query) => { | |
type props = {. "data": Query.data}; | |
let wrapComponent = (~component, ~make) => { | |
let jsComponent = | |
ReasonReact.wrapReasonForJs( | |
~component=component, | |
(props: props) => { | |
let data = props##data; | |
make(~data=data, [||]); | |
} | |
); | |
graphql(Query.query, jsComponent); | |
}; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment