How to use the react-router.run function in react-router

To help you get started, we’ve selected a few react-router examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DesignOpen / board / src / frontend / scripts / main.jsx View on Github external
var React = require('react');
var Router = require('react-router');

var routes = require('./routes.jsx');

var container = document.querySelector('#app');
var initialData = JSON.parse(document.querySelector('#initial-data').innerHTML);

Router.run(routes, Router.HistoryLocation, function renderHandler(Handler, state) {
    // state.routes contains array of matched routes. The last item
    // is the innermost handler, see
    // https://github.com/rackt/react-router/issues/813
    var Component = state.routes[state.routes.length - 1].handler;
    React.render(
        ,
        container
    );
});
github jlfwong / 1rt / src / universalRouter.js View on Github external
return new Promise((resolve, reject) => {
    Router.run(routes, location, [createTransitionHook(store)], (error, initialState, transition) => {
      if (error) {
        return reject(error);
      }

      if (transition && transition.redirectInfo) {
        return resolve({
          transition,
          isRedirect: true
        });
      }

      if (history) {  // only on client side
        initialState.history = history;
      }

      const component = (
github devexp-org / review-bot / core / client / index.jsx View on Github external
if (process.env.NODE_ENV !== 'production') {
    alt.dispatcher.register(console.log.bind(console));
}

var Route = Router.Route,
    routes;

routes = (
    
        
        
        
    
);

Router.run(routes, Router.HistoryLocation, (Root) => {
    React.render(, document.getElementById('devexp-react-app'));
});
github coodict / coodict.com / app / app.jsx View on Github external
var routes = (
  
    
    
    
    

    
    
    

    
  
);
Router.run(routes, function(Handler) {
  React.render(,
  document.getElementById('Coodict'));
});
github webkom / lego-webapp / server.js View on Github external
app.use(function(req, res) {
  Router.run(routes, req.url, function(Handler) {
    fs.readFile('public/template.html', 'utf8', function(err, content) {
      res.send(content.replace('{{content}}', React.renderToString(React.createElement(Handler))));
    });
  });
});
github ericclemmons / react-resolver / examples / stargazers / bin / generate-index.js View on Github external
import fs from "fs";
import jsdom from "jsdom";
import React from "react";
import { Resolver } from "react-resolver";
import Router from "react-router";

import routes from "../routes";

global.document = jsdom.jsdom("");

const layout = fs.readFileSync(`${__dirname}/../layout.html`, "utf8");

Router.run(routes, (Handler) => {
  Resolver.renderToString().then((string) => {
    const html = layout.replace(/
github calvinchengx / webpack-simple / server.jsx View on Github external
var ServerRender = function(req, res, next) {
  Router.run(routes, req.url, function(Handler, state) {
    var title = DocumentTitle.rewind();
    var markup = React.renderToString();
    var html = React.renderToStaticMarkup();
    res.send('' + html);
  });
};
github kern / filepizza / src / client.js View on Github external
window.FilePizza = () => {
  ReactRouter.run(routes, ReactRouter.HistoryLocation, function(Handler) {
    React.render(, document);
  });

  if (!webrtcSupport.support) SupportActions.noSupport();

  let isChrome = navigator.userAgent.toLowerCase().indexOf("chrome") > -1;
  if (isChrome) SupportActions.isChrome();
};
github conceptviz / conceptviz.github.io / src / index.jsx View on Github external
});
}

var routes = (
  
    
    
      
    
    
      
    
  
);

ReactRouter.run(routes, function (Handler, state) {
  React.render(, document.getElementById('app-container'));
});