Last active
October 13, 2015 08:14
-
-
Save nickretallack/66ebbfdc920393bcf649 to your computer and use it in GitHub Desktop.
Why can't I put more than one level of
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
Uncaught Error: Invariant Violation: Relay.QL: Expected query `viewer` to be empty. For example, use `node(id: $id)`, not `node(id: $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
import 'babel/polyfill'; | |
class App extends React.Component { | |
render() { | |
return ( | |
<div> | |
<h1>Widget list</h1> | |
<ul> | |
{this.props.edges.map(edge => | |
<li>{edge.node.name} (ID: {edge.node.id})</li> | |
)} | |
</ul> | |
</div> | |
); | |
} | |
} | |
export default Relay.createContainer(App, { | |
fragments: { | |
edges: () => Relay.QL` | |
fragment on WidgetEdge { | |
node { | |
id, | |
name, | |
}, | |
} | |
`, | |
}, | |
}); |
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 extends Relay.Route { | |
static queries = { | |
edges: () => Relay.QL` | |
query { | |
viewer { | |
widgets(first: 10) { | |
edges | |
} | |
} | |
} | |
`, | |
}; | |
static routeName = 'AppHomeRoute'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment