Fragment Colocation Example
UserAvatar Component
import { graphql, useFragment, type FragmentType } from './gql';
const fragment = graphql(`
fragment UserAvatar_User on User {
name
avatarURL
}
`);
export function UserAvatar(props: { user: FragmentType }) {
const user = useFragment(fragment, props.user);
return
![{user.name}]({user.avatarURL})
;
}
ඞཁͱ͢ΔσʔλࣗࣗͰએݴ͢Δ
PopularPosts (Root)
PostSummary
UserAvatar
PostSummary
UserAvatar