Basic config and layout for fetching, showing wp data with graphql
This commit is contained in:
10
src/pages/404.js
Normal file
10
src/pages/404.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import React from 'react'
|
||||
|
||||
const NotFoundPage = () => (
|
||||
<div>
|
||||
<h1>NOT FOUND</h1>
|
||||
<p>You just hit a route that doesn't exist... the sadness.</p>
|
||||
</div>
|
||||
)
|
||||
|
||||
export default NotFoundPage
|
||||
9
src/pages/index.js
Normal file
9
src/pages/index.js
Normal file
@@ -0,0 +1,9 @@
|
||||
import React from 'react'
|
||||
|
||||
const IndexPage = () => (
|
||||
<div>
|
||||
<h1>Index page</h1>
|
||||
</div>
|
||||
)
|
||||
|
||||
export default IndexPage
|
||||
24
src/pages/page.js
Normal file
24
src/pages/page.js
Normal file
@@ -0,0 +1,24 @@
|
||||
import React, { Component } from 'react';
|
||||
|
||||
class Page extends Component {
|
||||
render() {
|
||||
const { data } = this.props
|
||||
return (
|
||||
<div>
|
||||
<h1>Specific Page - {data.wordpressPage.title}</h1>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export const query = graphql`
|
||||
query PageQuery {
|
||||
wordpressPage(slug: {eq: "about"}) {
|
||||
title
|
||||
slug
|
||||
content
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
export default Page;
|
||||
Reference in New Issue
Block a user