mirror of
https://github.com/wassname/talk.git
synced 2026-07-05 02:00:39 +08:00
19 lines
575 B
JavaScript
19 lines
575 B
JavaScript
import React from 'react';
|
|
|
|
// TODO: revisit `filtering` after https://github.com/apollographql/graphql-anywhere/issues/38.
|
|
|
|
function getDisplayName(WrappedComponent) {
|
|
return WrappedComponent.displayName || WrappedComponent.name || 'Component';
|
|
}
|
|
|
|
export default fragments => WrappedComponent => {
|
|
class WithFragments extends React.Component {
|
|
render() {
|
|
return <WrappedComponent {...this.props} />;
|
|
}
|
|
}
|
|
WithFragments.fragments = fragments;
|
|
WithFragments.displayName = `WithFragments(${getDisplayName(WrappedComponent)})`;
|
|
return WithFragments;
|
|
};
|