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 ReactRouterRelay from 'react-router-relay'; | |
// ... | |
React.render( | |
<Router | |
history={new BrowserHistory()} | |
createElement={ReactRouterRelay.createElement}> | |
<Route | |
name="home" // added a name to the route |
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
<!doctype html> | |
<html> | |
<head> | |
<style type="text/css"> | |
body { | |
margin: 0; | |
} | |
iframe { | |
bottom: 0; |
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
<RelayRootContainer | |
Component={Component} | |
route={{name, params, queries}} | |
/> |
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
<Link href={getURIBuilder(ProfileRoute).setString('id', user.id).getURI()}> | |
{user.name} | |
</Link> |
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
function matchRoute<T>( | |
route: {name: string}, | |
map: {[key: string]: () => T} | |
): ?T { | |
return map[route.name] ? map[route.name]() : null; | |
} | |
// Usage | |
matchRoute(this.props.route, { | |
'ProfileRoute': () => <Profile {...props} />, |
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 relayNestedRoutes from 'relay-nested-routes'; | |
const NestedRootContainer = relayNestedRoutes(React, Relay); | |
React.render( | |
<Router history={new BrowserHistory()}> | |
<Route component={NestedRootContainer}> | |
<Route | |
name="home" // added a name to the route | |
path="/" |
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 {Router, Route} from 'react-router'; | |
import BrowserHistory from 'react-router/lib/BrowserHistory'; | |
import App from './components/App'; | |
import Widget from './components/Widget'; | |
// A wrapper to create a Relay container | |
function createRelayContainer(Component, props) { | |
if (Relay.isContainer(Component)) { | |
// Construct the RelayQueryConfig from the route and the router props. |
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
/** | |
* @providesModule LJPEG | |
*/function c(a){throw a;}var k=void 0,m=!0,s=null,u=!1,v;v||(v=eval("(function() { try { return Module || {} } catch(e) { return {} } })()"));var aa={},w;for(w in v)v.hasOwnProperty(w)&&(aa[w]=v[w]);var ba="object"===typeof process&&"function"===typeof require,ca="object"===typeof window,da="function"===typeof importScripts,ea=!ca&&!ba&&!da; | |
if(ba){v.print=function(a){process.stdout.write(a+"\n")};v.printErr=function(a){process.stderr.write(a+"\n")};var fa=require.call(null, "fs"),ga=require.call(null, "path");v.read=function(a,b){var a=ga.normalize(a),d=fa.readFileSync(a);!d&&a!=ga.resolve(a)&&(a=path.join(__dirname,"..","src",a),d=fa.readFileSync(a));d&&!b&&(d=d.toString());return d};v.readBinary=function(a){return v.read(a,m)};v.load=function(a){ha(read(a))};v.arguments=process.argv.slice(2);module.exports=v}else ea?(v.print=print,"undefined"!=typeof printErr&& | |
(v.printErr=printErr),v.read="undefined"!=typeof read?read:function(){c("no read() available (jsc?)")},v.readBinary=f |
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
module.exports = function(file, api) { | |
var j = api.jscodeshift; // alias the jscodeshift API | |
var root = j(file.source); // parse JS code into an AST | |
// the main update method replaces merge with ObjectExpression | |
const update = path => | |
j(path).replaceWith(j.objectExpression( | |
flatten(path.value.arguments.map(p => | |
p.type == 'ObjectExpression' | |
? p.properties |
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
instance.extend("parseImportSpecifiers", function (inner) { | |
return function (node) { | |
node.importKind = "value" | |
if (this.isContextual("type") || this.type === tt._typeof) { | |
if (this.type === tt._typeof) { | |
node.importKind = "typeof" | |
this.eat(tt._typeof) | |
} |