Skip to content

Instantly share code, notes, and snippets.

@MattJonesCreation
Created April 2, 2019 12:50
Show Gist options
  • Save MattJonesCreation/5c658b9594414d38319fdfb2cc8b01be to your computer and use it in GitHub Desktop.
Save MattJonesCreation/5c658b9594414d38319fdfb2cc8b01be to your computer and use it in GitHub Desktop.
// index.js
import React, { Component } from 'react'
import ReactDOM from 'react-dom'
import { BrowserRouter, Switch, Route } from 'react-router-dom'
import UnauthorizedLayout from 'layouts/UnauthorizedLayout'
import ErrorLayout from 'layouts/ErrorLayout'
import AuthorizedLayout from 'layouts/AuthorizedLayout'
import AuthorizedRoute from 'custom-routes/AuthorizedRoute'
import GA from 'utils/GoogleAnalytics'
class App extends Component {
render () {
return (
<BrowserRouter>
{ GA.init() && <GA.RouteTracker /> }
<Switch>
<Route path='/auth' component={UnauthorizedLayout} />
<Route path='/error' component={ErrorLayout} />
<AuthorizedRoute path='/' component={AuthorizedLayout} />
</Switch>
</BrowserRouter>
)
}
}
ReactDOM.render(<App />, document.getElementById('root'))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment