Using gql-tag-operations preset with imported fragments #6550
Answered
by
dotansimha
amosbastian
asked this question in
Q&A
-
|
I have just started a new project and am trying out the // Tweet.tsx
import { TweetFragmentType } from '../gql';
import { gql } from 'graphql-tag';
export const TweetFragment = gql`
fragment TweetFragment on Tweet {
id
body
}
`;
const Tweet = (props: {
tweet: TweetFragmentType;
}) => {
return <li data-id={props.id}>{props.body}</li>;
};and // Tweets.tsx
import { gql } from 'graphql-tag';
import { TweetFragment } from './Tweet';
const TweetsQuery = gql`
query TweetsQuery {
tweets {
id
...TweetFragment
}
}
${TweetFragment}
`;
const Tweets = () => {
...
return (
<ul>
{data.tweets.map(tweet => (
<Tweet key={tweet.id} tweet={tweet} />
))}
</ul>
);
};I was wondering if there is a way to do it with the |
Beta Was this translation helpful? Give feedback.
Answered by
dotansimha
Sep 6, 2021
Replies: 1 comment 6 replies
-
|
@n1ru4l any idea? |
Beta Was this translation helpful? Give feedback.
6 replies
Answer selected by
amosbastian
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@n1ru4l any idea?