Skip to content

Instantly share code, notes, and snippets.

@JacobKnaack
Last active Apr 16, 2019
Embed
What would you like to do?
Apollo-blog root App component
import React, { Component } from 'react'
import ApolloClient from 'apollo-boost'
import { ApolloProvider } from 'react-apollo'
import { BrowserRouter, Route } from 'react-router-dom'
import './App.css'
import 'semantic-ui-css/semantic.min.css'
import Home from './views/home'
import Article from './views/article'
// creates our Graphql client using the CosmicJS Graphql endpoint
const client = new ApolloClient({
uri: "https://graphql.cosmicjs.com/v1"
})
class App extends Component {
render() {
return (
<ApolloProvider client={client}>
<BrowserRouter>
<div className="router-container">
<Route exact path="/" component={Home} />
<Route path="/article/:articleName" component={Article} />
</div>
</BrowserRouter>
</ApolloProvider>
)
}
}
export default App
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment