How to use the react-router.Router 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 mozilla / learning.mozilla.org / lib / routes.jsx View on Github external
var React = require('react');

var ReactRouter = require('react-router');
var Router = ReactRouter.Router;
var IndexRedirect = ReactRouter.IndexRedirect;
var Route = ReactRouter.Route;
var Redirect = ReactRouter.Redirect;
var IndexRoute = ReactRouter.IndexRoute;
var config = require('../config/config');
var SUPPORTED_LOCALES = config.SUPPORTED_LOCALES;
var MAKER_PARTY_LOCALES = config.MAKER_PARTY_LOCALES;


// verify we have at least one locale
if (SUPPORTED_LOCALES.length === 0) {
  console.error("No locales were loaded into routes.jsx, no routes can be built!");
  process.exit(1);
}
github mozilla / learning.mozilla.org / lib / page-generator.jsx View on Github external
var React = require('react');
var ReactDOM = require('react-dom');
var ReactDOMServer = require('react-dom/server');

var ReactRouter = require('react-router');
var Router = ReactRouter.Router;
var RoutingContext = ReactRouter.RoutingContext;
var match = ReactRouter.match;

var routeData = require('./routes.jsx');
var Page = require('../components/page.jsx');

var locales = require('../dist/locales.json');
var ReactIntl = require('react-intl');
var IntlProvider = ReactIntl.IntlProvider;
var addLocaleData = ReactIntl.addLocaleData;
var currentLocale;

var ga = require('react-ga');
var assign = require('object-assign');

// utility function: create element wrapped in React localisation
github PacktPublishing / Node.js_Design_Patterns_Second_Edition_Code / ch8 / 13_react_server_side_rendering / src / routes.js View on Github external
"use strict";

const React = require('react');
const ReactRouter = require('react-router');
const Router = ReactRouter.Router;
const hashHistory = ReactRouter.hashHistory;
const routesConfig = require('./routesConfig');

class Routes extends React.Component {
  render() {
    return ;
  }
}

module.exports = Routes;
github sachinjain024 / stackeye / src / pages / index / components / routes.jsx View on Github external
var React = require('react');
var ReactRouter = require('react-router');
var Router = ReactRouter.Router;
var Route = ReactRouter.Route;
var Main = require('./main.jsx');
var HashHistory = ReactRouter.hashHistory;

var QuestionNotifications = require('./question-notifications.jsx');
var UserNotifications = require('./user-notifications.jsx');
var QuestionsList = require('./questions-list.jsx');
var UsersList = require('./users-list.jsx');

var routeConfig = [
  {
    path: '/',
    component: Main,
    indexRoute: {
      onEnter: function (nextState, replace) {
        replace('/questions/notifications');
github jackfranklin / react-training-workshop / exercises / route-params / src / app.js View on Github external
var React = require('react');
var ReactDOM = require('react-dom');

var ReactRouter = require('react-router');
var Router = ReactRouter.Router;
var Route = ReactRouter.Route;
var Link = ReactRouter.Link;
var IndexLink = ReactRouter.IndexLink;
var IndexRoute = ReactRouter.IndexRoute;
var hashHistory = ReactRouter.hashHistory;
var Users = require('./users');

var App = React.createClass({
  render: function() {
    return (
      <div>
        <ul>
          <li>Home</li>
          <li>About Jack</li>
          <li>About Phil</li>
        </ul></div>
github divio / djangocms-rest-api / example_project / react-app / src / index.js View on Github external
import React from "react";
import App from "./App";
import Page from "./components/Page";
import { render } from 'react-dom';
import "bootstrap/dist/css/bootstrap.css";
import "bootstrap/dist/css/bootstrap-theme.css";
import "./index.css";

var Router = require('react-router').Router;
var Route = require('react-router').Route;
var browserHistory = require('react-router').browserHistory;

render((
  
    
        

    
  
), document.getElementById('root'));
github cozy / cozy.github.io / en / cozy-banks / src / AppContainer.jsx View on Github external
const AppContainer = ({ store, lang, history, client }) =&gt; {
  const AppRoute = require('components/AppRoute').default
  const Router =
    __TARGET__ === 'mobile' || flag('authentication')
      ? require('ducks/mobile/MobileRouter').default
      : require('react-router').Router
  return (
    &lt;&gt;
      
      
        
           require(`locales/${lang}`)}&gt;
            
              
            
          
        
      
    
  )
}
github wesbos / React-For-Beginners-Starter-Files / 12 - Displaying State with JSX / scripts / main.js View on Github external
var React = require('react');
var ReactDOM = require('react-dom');

var ReactRouter = require('react-router');
var Router  = ReactRouter.Router;
var Route = ReactRouter.Route;
var History = ReactRouter.History;
var createBrowserHistory = require('history/lib/createBrowserHistory');

var h = require('./helpers');

/*
  App
*/

var App = React.createClass({
  getInitialState : function() {
    return {
      fishes : {},
      order : {}
    }
github lore / lore / packages / lore / src / app / getRoot.js View on Github external
var React = require('react');
var ReactRedux = require('react-redux');
var Provider = ReactRedux.Provider;
var ReactRouter = require('react-router');
var Router = ReactRouter.Router;

/**
 * Build the root React component that will be mounted to the DOM. Basic application
 * boilerplate that knows how to connect the app to the Redux store and configure
 * react-router for proper application navigation.
 *
 * @param {Store} store Redux store
 * @param {Component} routes Set of react-router routes
 * @returns {Component} The React component that will be mounted to the DOM
 */
module.exports = function getRoot(store, routes) {

  function renderRoutes(history) {
    return React.createElement(
      Router, {
        history: history