title: Calling compose on React components with imported functions
body: <p>I am trying to call several functions on a React component I have created, specifically the <code>graphql()</code> function from <a href="https://github.com/apollographql/react-apollo" rel="nofollow noreferrer">react-apollo</a></p>
  
  <p>I use the pattern: </p>
  
  <pre><code>import someFunction from "../somewhere";
  
  const withData = compose(
    graphql(gqlDocument, { name: "Name" }),
    graphql(anotherDocument, { name: "Name2" }),
    someFunction()
    ...
  )
  const ComponentWithData = withData(Component);
  export default ComponentWithData
  </code></pre>
  
  <p>This works fine, unless I try to use a function that I have defined in another file and imported. despite literally being of the exact same form, i.e. <code>graphql(document, { name: "Name" })</code> I get the error: <code>Uncaught TypeError: Cannot read property 'apply' of undefined</code>. If I simply copy and paste the function from the external module and put it inside the compose block, it works perfectly, so the issue has to be with how react is dealing <code>apply</code> inside this function composition.</p>
  
  <p>When the function works, it <code>ComponetWithData</code> should have a prop called "Name" that represents the graphql document passed to the <code>graphql()</code> function. This is particularly perplexing because react-apollo's implementation of subscriptions has you passing a React component to a function that alters its props, and yet I can define subscription functions externally with no hassle. here is the pattern for reference:</p>
  
  <pre><code>const COMMENTS_SUBSCRIPTION = gql`
      subscription onCommentAdded($repoFullName: String!){
        commentAdded(repoFullName: $repoFullName){
          id
          content
        }
      }
  `;
  const withData = graphql(COMMENT_QUERY, {
      name: 'comments',
      options: ({ params }) =&gt; ({
          variables: {
              repoName: `${params.org}/${params.repoName}`
          },
      }),
      props: props =&gt; {
          return {
              subscribeToNewComments: params =&gt; {
                  return props.comments.subscribeToMore({
                      document: COMMENTS_SUBSCRIPTION,
                      variables: {
                          repoName: params.repoFullName,
                      },
                      updateQuery: (prev, {subscriptionData}) =&gt; {
                          if (!subscriptionData.data) {
                              return prev;
                          }
                          const newFeedItem = subscriptionData.data.commentAdded;
                          return Object.assign({}, prev, {
                              entry: {
                                  comments: [newFeedItem, ...prev.entry.comments]
                              }
                          });
                      }
                  });
              }
          };
      },
  });
  </code></pre>