This file contains 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
{ | |
"schemaPath": "schema.graphql", | |
"extensions": { | |
"endpoints": { | |
"prod": { | |
"url": "https://api.graph.cool/simple/v1/swapi", | |
"subscription": { | |
"url": "wss://subscriptions.graph.cool/simple/v1/swapi" | |
} | |
}, |
This file contains 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 Relay from 'react-relay' | |
// ... | |
export default Relay.createContainer(TodoList, { | |
fragments: { | |
viewer: () => Relay.QL` | |
fragment on Viewer { | |
allTodoes(last: 1000) { | |
edges { |
This file contains 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 {createFragmentContainer, graphql} from 'react-relay' | |
// ... | |
export default createFragmentContainer(TodoList, { | |
viewer: graphql` | |
fragment TodoList_viewer on Viewer { | |
allTodoes(last: 1000) { | |
edges { | |
node { | |
id, | |
complete, |
This file contains 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 Relay from 'react-relay' | |
// ... | |
export default Relay.createContainer(Todo, { | |
fragments: { | |
todo: () => Relay.QL` | |
fragment on Todo { | |
id, | |
complete, |
This file contains 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 {createFragmentContainer, graphql} from 'react-relay' | |
| |
// ... | |
| |
export default createFragmentContainer(Todo, { | |
todo: graphql` | |
fragment Todo_todo on Todo { | |
id, | |
complete, | |
text, |
This file contains 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
export default createFragmentContainer(Todo, { | |
todo: graphql` | |
fragment Todo_todo on Todo { | |
id, | |
complete, | |
text, | |
} | |
`, | |
viewer: graphql` | |
fragment Todo_viewer on Viewer { |
This file contains 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
export default class ChangeTodoStatusMutation extends Relay.Mutation { | |
static fragments = { | |
todo: () => Relay.QL` | |
fragment on Todo { | |
id, | |
complete | |
} | |
`, | |
viewer: () => Relay.QL` | |
fragment on Viewer { |
This file contains 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 {commitMutation, graphql} from 'react-relay/compat' | |
const mutation = graphql` | |
mutation ChangeTodoStatusMutation( | |
$input: UpdateTodoInput! | |
) { | |
updateTodo(input: $input) { | |
todo { | |
id | |
complete | |
} |
This file contains 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 ChangeTodoStatusMutation from '../mutations/ChangeTodoStatusMutation' | |
// ... | |
ChangeTodoStatusMutation.commit( | |
this.props.relay.environment, | |
complete, | |
todo, | |
this.props.viewer.id | |
) |
This file contains 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
const root = <Relay.RootContainer | |
Component={TodoApp} | |
route={new ViewerRoute()} | |
renderFetched={(data) => { | |
return ( | |
<TodoApp | |
{...data} | |
/> | |
) | |
}} |
OlderNewer