Files
shields/pages/index.js
T
Paul MelnikowandGitHub 7a664ca3e8 Run prettier (#1866)
Merging this separately so the commit with the tooling change is readable. This is a follow-on to #1167 which turned prettier on.
2018-08-08 17:57:14 -04:00

24 lines
655 B
JavaScript

import React from 'react'
import { HashRouter, StaticRouter, Route } from 'react-router-dom'
import ExamplesPage from '../frontend/components/examples-page'
export default class Router extends React.Component {
render() {
const router = (
<div>
<Route path="/" exact component={ExamplesPage} />
<Route path="/examples/:id" component={ExamplesPage} />
</div>
)
if (typeof window !== 'undefined') {
// browser
return <HashRouter>{router}</HashRouter>
} else {
// server-side rendering
const context = {}
return <StaticRouter context={context}>{router}</StaticRouter>
}
}
}