Skip to content

Instantly share code, notes, and snippets.

View jamesknelson's full-sized avatar

James K Nelson jamesknelson

View GitHub Profile
@jamesknelson
jamesknelson / react-parent-context-patch.js
Last active January 9, 2016 17:53
Use parent context instead of owner context in facebook/react (#2112)
var ReactInstanceMap = require("react/lib/ReactInstanceMap");
var ReactLifeCycle = require("react/lib/ReactLifeCycle");
var ReactNativeComponent = require("react/lib/ReactNativeComponent");
var ReactReconciler = require("react/lib/ReactReconciler");
var emptyObject = require("react/lib/emptyObject");
var invariant = require("react/lib/invariant");
var warning = require("react/lib/warning");
var ReactCompositeComponentMixin = require('react/lib/ReactCompositeComponent').Mixin;
@jamesknelson
jamesknelson / gist:d18cbc97aeca53675b4e
Created October 5, 2015 12:50
Raw React `navigated` action
function navigated() {
// Choose which component to render based on browser URL
var component = window.location.hash == "#/"
? React.createElement('div', {}, "Index Page")
: React.createElement('div', {}, "Not Found")
// Render the new component to the page's #react-app element
ReactDOM.render(
component,
document.getElementById('react-app')