Skip to content

Instantly share code, notes, and snippets.

@jelorivera08
Created January 28, 2020 06:12
Show Gist options
  • Save jelorivera08/f2c480c20fdabf7fadacda982c8f7ca8 to your computer and use it in GitHub Desktop.
Save jelorivera08/f2c480c20fdabf7fadacda982c8f7ca8 to your computer and use it in GitHub Desktop.
// App.js
import React from 'react';
import { graphql, QueryRenderer } from 'react-relay';
import MainPage from './containers/MainPage';
import environment from '../environment';
export default class App extends React.Component {
render() {
return (
<QueryRenderer
environment={environment}
query={graphql`
query AppQuery {
notes {
_id
content
}
}
`}
variables={{}}
render={({ error, props }) => {
if (error) {
return <div>Error!</div>;
}
if (!props) {
return <div>Loading...</div>;
}
return <MainPage {...props} />;
}}
/>
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment