Skip to content

Instantly share code, notes, and snippets.

Ashok Rao ashokrao1

  • Bengaluru
Block or report user

Report or block ashokrao1

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ashokrao1
ashokrao1 / app.js
Created Dec 19, 2017 — forked from acdlite/app.js
Quick and dirty code splitting with React Router v4
View app.js
// getComponent is a function that returns a promise for a component
// It will not be called until the first mount
function asyncComponent(getComponent) {
return class AsyncComponent extends React.Component {
static Component = null;
state = { Component: AsyncComponent.Component };
componentWillMount() {
if (!this.state.Component) {
getComponent().then(Component => {
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
*, *:before, *:after {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
You can’t perform that action at this time.