Created
June 23, 2018 11:20
-
-
Save zapkub/e0b4462f21cce19f7e6b68f69a971547 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
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