Skip to content

Commit

Permalink
docs: Fix typo (useFragment -> readFragment) (0no-co#14)
Browse files Browse the repository at this point in the history
  • Loading branch information
kitten authored Jan 17, 2024
1 parent 35349df commit d51c841
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions website/src/content/docs/get-started/writing-graphql.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ For example, our `TodoItemFragment` may be associated with a `TodoItem` componen
individual items:

```tsx title="components/TodoItem.tsx" {"The component accepts a fragment mask of TodoItemFragment:":12-13} {"In the component body we unwrap the fragment mask:":17-18}
import { graphql, useFragment } from 'gql.tada';
import { graphql, readFragment } from 'gql.tada';

export const TodoItemFragment = graphql(`
fragment TodoItem on Todo {
Expand All @@ -251,7 +251,7 @@ interface Props {

export const TodoItemComponent = ({ data }: Props) => {

const todo = useFragment(TodoItemFragment, data);
const todo = readFragment(TodoItemFragment, data);

return <li />; // ...
};
Expand All @@ -264,7 +264,7 @@ We can then use our new `TodoItemComponent` in our `TodosListComponent` and comp
into our query:

```tsx title="components/TodoList.tsx" {"The masked fragment data is accepted as defined by FragmentOf:":19-20}
import { graphql, useFragment } from 'gql.tada';
import { graphql } from 'gql.tada';
import { TodoItemFragment, TodoItemComponent } from './TodoItem';

const TodosQuery = graphql(`
Expand Down

0 comments on commit d51c841

Please sign in to comment.