generator-base-reactjs
Version:
ReactJS basic skeleton for webapp development. With RequireJS, Bootstrap, Sass and templating with Jade. JSX compiled with Babel.
24 lines (21 loc) • 454 B
JavaScript
define(['page', 'react', 'react_dom'], function(Page, React, ReactDOM) {
'use strict';
Page.base('');
Page('/', index);
Page();
function index(ctx) {
if (ctx.hash !== '') {
Page(ctx.hash);
} else {
landing();
}
}
function landing() {
loadComponent('../js/components/landing');
}
function loadComponent(path) {
require([path], function(Component) {
ReactDOM.render(<Component/>, document.getElementById('app'));
});
}
});