Skip to content

Instantly share code, notes, and snippets.

@hitchcockwill
Last active June 11, 2019 14:27
Show Gist options
  • Save hitchcockwill/bd0a20e30e9b686446c881e012d11bfd to your computer and use it in GitHub Desktop.
Save hitchcockwill/bd0a20e30e9b686446c881e012d11bfd to your computer and use it in GitHub Desktop.
HOC Dashboard
import React from 'react';
import { graphql } from 'react-apollo';
import styles from './dashboard-scene.module.scss';
import { ME_QUERY } from 'app/models/me/me-schema';
import { Me } from 'app/models/me/me-types';
interface Props {
data: {
me: Me;
};
error: any;
loading: boolean;
}
export const DashboardScene = ({ loading, error, data }: Props) => {
if (loading) {
return <p>Loading...</p>;
}
if (error) {
return <p>Error: {JSON.stringify(error)}</p>;
}
return (
<div className={styles.dashboardLayout}>
<p>{JSON.stringify(data.me, null, 2)}</p>
</div>
);
};
export default graphql<any, any, any>(ME_QUERY)(DashboardScene);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment