Skip to content

Instantly share code, notes, and snippets.

@zapkub
Created June 23, 2018 11:20
Show Gist options
  • Save zapkub/e0b4462f21cce19f7e6b68f69a971547 to your computer and use it in GitHub Desktop.
Save zapkub/e0b4462f21cce19f7e6b68f69a971547 to your computer and use it in GitHub Desktop.
import { USER_INFOMATION_QUERY, USER_NOTIFICATION_QUERY, USER_INFOMATION_MUTATION } from './user.graphql'
import { graphql, compose } from 'react-apollo'
import UserInfomationComponent from './user.component'
// need to defined shape of
// prop types from enhanced component
type UserInfomationContainerPropTypes = {
userId: string
}
// defined shape of HOC type
type UserInfomationQueryPropTypes = { }
type UserInfomationQueryData = { }
type UserInfomationQueryVariables = { }
type UserInfomationQueryResultPropTypes = { }
export default compose(
graphql<UserInfomationQueryPropTypes, UserInfomationQueryData, UserInfomationQueryVariables, UserInfomationQueryResultPropTypes>(USER_INFOMATION_QUERY, {
props: ({ }) =>{
return {
}
}
}),
// over here, it need to merge result type from type above to prop type of current HOC
graphql<UserNotificationQueryPropTypes & UserInfomationQueryResultPropTypes, UserNotificationQueryData, UserNotificationQueryVariables, UserNotificationQueryResultProps>(USER_NOTIFICATION_QUERY, {
}),
... and so on 🙀
)(UserInfomationComponent) as React.SFC<UserInfomationContainerPropTypes>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment