Skip to content

Instantly share code, notes, and snippets.

@hitchcockwill
Last active June 11, 2019 14:27
Show Gist options
  • Save hitchcockwill/781f350baade0692b6d9d51a472d23bb to your computer and use it in GitHub Desktop.
Save hitchcockwill/781f350baade0692b6d9d51a472d23bb to your computer and use it in GitHub Desktop.
Component Dashboard
import React from 'react';
import { Query, QueryResult } 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 = () => {
return (
<div className={styles.dashboardLayout}>
<Query query={ME_QUERY}>
{({ loading, error, data }: QueryResult<Props>) => {
if (loading) {
return <p>Loading...</p>;
}
if (error) {
return <p>Error: {JSON.stringify(error)}</p>;
}
return <p>{JSON.stringify(data)}</p>;
}}
</Query>
</div>
);
};
export default DashboardScene;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment