Created
August 15, 2015 19:04
-
-
Save fortruce/f8c1ae5b5681800c4bc1 to your computer and use it in GitHub Desktop.
React Relay refs Violation
This file contains hidden or 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 class extends Relay.Route { | |
| static path = '/'; | |
| static queries = { | |
| game: (Component) => Relay.QL` | |
| query { | |
| game { | |
| ${Component.getFragment('game')}, | |
| }, | |
| } | |
| `, | |
| }; | |
| static routeName = 'AppHomeRoute'; | |
| } |
This file contains hidden or 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 React from 'react'; | |
| import Relay from 'react-relay'; | |
| class Application extends React.Component { | |
| render() { | |
| return ( | |
| <div> | |
| Hello World! | |
| </div> | |
| ); | |
| } | |
| } | |
| export default Relay.createContainer(Application, { | |
| fragments: { | |
| game: () => Relay.QL` | |
| fragment on Game { | |
| turnsRemaining | |
| } | |
| ` | |
| } | |
| }); |
This file contains hidden or 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 React from 'react'; | |
| import ReactDOM from 'react-dom'; | |
| import Relay from 'react-relay'; | |
| import AppHomeRoute from './routes/AppHomeRoute'; | |
| import Application from './components/Application'; | |
| class Root extends React.Component { | |
| render() { | |
| return ( | |
| <Relay.RootContainer | |
| Component={ Application } | |
| route={ new AppHomeRoute() } | |
| /> | |
| ); | |
| } | |
| } | |
| ReactDOM.render( | |
| <Root />, | |
| document.getElementById('container') | |
| ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment