Last active
April 16, 2019 23:47
-
-
Save JacobKnaack/51a7642e45bbe664557d29c6894fc29b to your computer and use it in GitHub Desktop.
Apollo-blog root App component
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
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