Skip to content

Instantly share code, notes, and snippets.

@iamkevingreen
Created February 21, 2017 23:00
Show Gist options
  • Save iamkevingreen/108ea0ba7b819818cb3116bf714b4ec2 to your computer and use it in GitHub Desktop.
Save iamkevingreen/108ea0ba7b819818cb3116bf714b4ec2 to your computer and use it in GitHub Desktop.
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