Skip to content

Gabriel/Step four#46

Draft
grrlopes wants to merge 9 commits intobutton-inc:mainfrom
grrlopes:step_four
Draft

Gabriel/Step four#46
grrlopes wants to merge 9 commits intobutton-inc:mainfrom
grrlopes:step_four

Conversation

@grrlopes
Copy link

No description provided.

Comment on lines +16 to +20
nodes {
id
completed
task
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will definitely work for returning the set of nodes (each todo in the database). But when returning a set, I'd suggest using edges.
edges contain more information about where each result connects within the set and can be used to add / remove "todos" easily using the connection directive.
https://relay.dev/docs/guided-tour/list-data/updating-connections/#adding-edges

Suggested change
nodes {
id
completed
task
}
edges {
node {
id
completed
task
}
}

Comment on lines +16 to +20
nodes {
id
completed
task
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can actually take this one step further and create another component for each individual node. In this fragment we can spread another fragment and create a new component that is only repsonsible for displaying each todo item. ie: TodoListItem.tsx

Suggested change
nodes {
id
completed
task
}
edges {
node {
...TodoListItem_todo
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants