Last active
June 11, 2019 14:27
-
-
Save hitchcockwill/bd0a20e30e9b686446c881e012d11bfd to your computer and use it in GitHub Desktop.
HOC Dashboard
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 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