Created
February 21, 2017 23:00
-
-
Save iamkevingreen/108ea0ba7b819818cb3116bf714b4ec2 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 { render } from 'react-dom'; | |
// Pages | |
import Home from './pages/home'; | |
import Product from './pages/product'; | |
class HomeLayout extends Component { | |
render() { | |
return ( | |
<div> | |
<Home /> | |
</div> | |
); | |
} | |
} | |
class ProductLayout extends Component { | |
render() { | |
let id = document.getElementById('Product').getAttribute('data-id'); | |
return ( | |
<div> | |
<Product id={id} /> | |
</div> | |
); | |
} | |
} | |
if (document.getElementById('Home')) { // eslint-disable-line | |
render(<HomeLayout />, | |
document.getElementById('Home') // eslint-disable-line | |
); | |
} | |
if (document.getElementById('Product')) { // eslint-disable-line | |
render(<ProductLayout />, | |
document.getElementById('Product') // eslint-disable-line | |
); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment