Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Relay Modern example (#10150)
* chore(npm): update dependencies * fix(relay): move GraphQL query outside pages folder * refactor(react): destructure props * refactor(react): remove unused key and simplify syntax
- Loading branch information
1 parent
b72b8e2
commit 71e29cd
Showing
5 changed files
with
38 additions
and
43 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,31 @@ | ||
{ | ||
"name": "with-relay-modern", | ||
"version": "3.0.3", | ||
"version": "3.0.4", | ||
"description": "Example of Next.js with Relay Modern SSR", | ||
"scripts": { | ||
"graphcool-init": "graphcool init --schema schema/init-schema.graphql", | ||
"dev": "next", | ||
"build": "next build", | ||
"start": "next start", | ||
"relay": "relay-compiler --src ./ --exclude '**/.next/**' '**/node_modules/**' '**/test/**' '**/__generated__/**' --exclude '**/schema/**' --schema ./schema/schema.graphql", | ||
"schema": "graphql get-schema dev" | ||
"schema": "graphql get-schema -e dev" | ||
}, | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"dotenv": "^4.0.0", | ||
"dotenv-webpack": "^1.5.4", | ||
"graphql": "^14.1.1", | ||
"dotenv": "^8.2.0", | ||
"dotenv-webpack": "^1.7.0", | ||
"graphql": "^14.5.8", | ||
"isomorphic-unfetch": "^3.0.0", | ||
"next": "latest", | ||
"react": "^16.7.0", | ||
"react-dom": "^16.7.0", | ||
"react-relay": "^5.0.0" | ||
"react": "^16.12.0", | ||
"react-dom": "^16.12.0", | ||
"react-relay": "^8.0.0" | ||
}, | ||
"devDependencies": { | ||
"babel-plugin-relay": "^2.0.0", | ||
"graphcool": "^1.2.1", | ||
"graphql-cli": "^1.0.0-beta.4", | ||
"relay-compiler": "^2.0.0" | ||
"babel-plugin-relay": "^8.0.0", | ||
"graphcool": "^1.4.0", | ||
"graphql-cli": "^3.0.14", | ||
"relay-compiler": "^8.0.0" | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,14 @@ | ||
import React, { Component } from 'react' | ||
import { graphql } from 'react-relay' | ||
import React from 'react' | ||
import withData from '../lib/withData' | ||
import BlogPosts from '../components/BlogPosts' | ||
import indexPageQuery from '../queries/indexPage' | ||
|
||
class Index extends Component { | ||
static displayName = `Index` | ||
|
||
render(props) { | ||
return ( | ||
<div> | ||
<BlogPosts viewer={this.props.viewer} /> | ||
</div> | ||
) | ||
} | ||
} | ||
const Index = ({ viewer }) => ( | ||
<div> | ||
<BlogPosts viewer={viewer} /> | ||
</div> | ||
) | ||
|
||
export default withData(Index, { | ||
query: graphql` | ||
query pages_indexQuery { | ||
viewer { | ||
...BlogPosts_viewer | ||
} | ||
} | ||
`, | ||
query: indexPageQuery, | ||
}) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { graphql } from 'react-relay' | ||
|
||
export default graphql` | ||
query indexPage_indexQuery { | ||
viewer { | ||
...BlogPosts_viewer | ||
} | ||
} | ||
` |