import React from 'react'
// just get render function from react-dom. means we don't have to get all of ReactDOM, and use ReactDOM.render
import { render } from 'react-dom'
import { BrowserRouter, Match } from 'react-router'
import Landing from './Landing'
import Search from './Search'
import Details from './Details'
import '../public/normalize.css'
import '../public/style.css'

const App = React.createClass({
  render () {
    return (
      <BrowserRouter>
        <div className='app'>
          <Match exactly pattern='/' component={Landing} />
          <Match pattern='/search' component={Search} />
          <Match pattern='/details/:id' component={Details} />
        </div>
      </BrowserRouter>
    )
  }
})

// need to call render at bottom
render(<App />, document.getElementById('app'))

import React from 'react'
// just get render function from react-dom. means we don't have to get all of ReactDOM, and use ReactDOM.render
import { render } from 'react-dom'
import { BrowserRouter, Match } from 'react-router'
import Landing from './Landing'
import Search from './Search'
import Details from './Details'
import preload from '../public/data.json'
import '../public/normalize.css'
import '../public/style.css'

const App = React.createClass({
  render () {
    return (
      <BrowserRouter>
        <div className='app'>
          <Match exactly pattern='/' component={Landing} />
          <Match
            pattern='/search'
            component={(props) => <Search shows={preload.shows} {...props} />}
          />
          <Match pattern='/details/:id' component={Details} />
        </div>
      </BrowserRouter>
    )
  }
})

// need to call render at bottom
render(<App />, document.getElementById('app'))

Refactor preloaded json data to ancestor so search and details can both access it; refactor how Search component is rendered so we can pass params to it in BrowserRouter.
Refactor preloaded json data to ancestor so search and details can both access it; refactor how Search component is rendered so we can pass params to it in BrowserRouter.
