Last active
August 4, 2020 17:46
-
-
Save kieran/cf0e658deedf83c304cb1e522f985e98 to your computer and use it in GitHub Desktop.
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
fragment UserCardFragment on User { | |
id | |
url | |
avatarUrl | |
} |
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
var UserCard; | |
export default UserCard = class UserCard extends React.Component { | |
render() { | |
return <> | |
<a href={props.user.url}> | |
<img src={props.user.avatarUrl} /> | |
<span>{props.user.email}</span> | |
</a> | |
</>; | |
} | |
}; |
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
var Profile; | |
// import the "dumb" component | |
import UserCard from '/components/user-card'; | |
// define the screen / layout | |
export default Profile = class Profile extends React.Component { | |
render() { | |
return <> | |
<h1>{props.user.name}'s Profile</h1> | |
<UserCard user={props.user} /> | |
</>; | |
} | |
}; |
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 "/components/user-card/fragment.gql" | |
query user($id: ID!) { | |
user(id: $id) { | |
id | |
name | |
...UserCardFragment | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment