How to use the react-router-dom.Switch function in react-router-dom

To help you get started, we’ve selected a few react-router-dom 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 z1c0 / dashydash / src / routes.jsx View on Github external
"use strict";

var React = require('react');
var RouterDOM = require('react-router-dom');
var Route = RouterDOM.Route;
var Switch = RouterDOM.Switch;

var Home = require('./components/boards/home.jsx');
var Board = require('./components/boards/board.jsx');
var NotFound = require('./404.jsx');


var routes = (
  
)

module.exports = routes;
github escherpad / escherpad / web-app / build / Root.js View on Github external
function Root() {
    return _react2.default.createElement(
        _reactRouterDom.Switch,
        null,
        _react2.default.createElement(_reactRouterDom.Route, { exact: true, path: "/", component: function component() {
                return _react2.default.createElement(_FrontPage2.default, null);
            } }),
        _react2.default.createElement(_reactRouterDom.Route, { exact: true, path: "/findr", component: _Findr2.default }),
        _react2.default.createElement(_reactRouterDom.Route, { exact: true, path: "/todo", component: _Todo2.default }),
        _react2.default.createElement(_reactRouterDom.Route, { exact: true, path: "/github/:account/gists/:path*", component: _Escherpad2.default }),
        _react2.default.createElement(_reactRouterDom.Route, { exact: true, path: "/github/:account/:repo/:path*", component: _Escherpad2.default }),
        _react2.default.createElement(_reactRouterDom.Route, { exact: true, path: "/dropbox/:account/:path*", component: _Escherpad2.default }),
        _react2.default.createElement(_reactRouterDom.Route, { exact: true, path: "/:username/", component: _Escherpad2.default }),
        _react2.default.createElement(_reactRouterDom.Route, { exact: true, path: "/:username/notes:/:note_id", component: _Escherpad2.default }),
        _react2.default.createElement(_reactRouterDom.Route, { exact: true, path: "/:username/:bindr_id/", component: _Escherpad2.default }),
        _react2.default.createElement(_reactRouterDom.Route, { exact: true, path: "/:username/:bindr_id*/:note_id", component: _Escherpad2.default }),
        _react2.default.createElement(_reactRouterDom.Route, { component: _2.default })
    );
}
github Houfeng / doczilla / src / common / router.js View on Github external
import * as rd from 'react-router-dom';
import { normalize } from 'path';
import conf from '$config';

//计算 conf
const defConf = { mode: 'hash', baseUri: '', extname: '.html' };
const docConf = (() => {
  const { mode, baseUri } = (global.DOC_DATA || {});
  return { mode, baseUri };
})();
const routeConf = Object.assign(defConf, conf.router, docConf, global.router);
if (conf.env === 'dev') Object.assign(routeConf, conf.router);

const Switch = rd.Switch;
const Router = {
  hash: rd.HashRouter,
  browser: rd.BrowserRouter,
  static: rd.StaticRouter,
}[routeConf.mode] || rd.HashRouter;

const Route = {
  hash: rd.Route,
  static: rd.Route,
  browser: props => {
    const { path, children, ...others } = props;
    const { baseUri } = routeConf;
    return 
      {children}
    ;
  },
github lbryio / spee.ch / client / build / app.js View on Github external
var App = function App() {
  return _react.default.createElement(_reactRouterDom.Switch, null, _react.default.createElement(_reactRouterDom.Route, {
    exact: true,
    path: "/",
    component: _HomePage.default
  }), _react.default.createElement(_reactRouterDom.Route, {
    exact: true,
    path: "/about",
    component: _AboutPage.default
  }), _react.default.createElement(_reactRouterDom.Route, {
    exact: true,
    path: "/login",
    component: _LoginPage.default
  }), _react.default.createElement(_reactRouterDom.Route, {
    exact: true,
    path: "/multisite",
    component: _MultisitePage.default
  }), _react.default.createElement(_reactRouterDom.Route, {
github escherpad / escherpad / web-app / server-src-build / Root.js View on Github external
function Root() {
    return _react2.default.createElement(
        _reactRouterDom.Switch,
        null,
        _react2.default.createElement(_reactRouterDom.Route, { exact: true, path: "", component: _FrontPage2.default }),
        _react2.default.createElement(_reactRouterDom.Route, { exact: true, path: "/findr", component: FindrBundle }),
        _react2.default.createElement(_reactRouterDom.Route, { exact: true, path: "/todo", component: _Todo2.default }),
        _react2.default.createElement(_reactRouterDom.Route, { exact: true, path: "/notes", component: EscherpadBundle }),
        _react2.default.createElement(_reactRouterDom.Route, { exact: true, path: "/github/:account/gists/:path*", component: EscherpadBundle }),
        _react2.default.createElement(_reactRouterDom.Route, { exact: true, path: "/github/:account/:repo/:path*", component: EscherpadBundle }),
        _react2.default.createElement(_reactRouterDom.Route, { exact: true, path: "/dropbox/:account/:path*", component: EscherpadBundle }),
        _react2.default.createElement(_reactRouterDom.Route, { component: _2.default })
    );
}
//# sourceMappingURL=Root.js.map
github burtonator / polar-bookshelf / web / spectron0 / react-router / App.js View on Github external
render() {
        return (React.createElement("div", { style: { margin: '5px' } },
            React.createElement(react_router_dom_1.BrowserRouter, null,
                React.createElement(react_router_dom_1.Switch, { location: ReactRouters_1.ReactRouters.createLocationWithPathnameHash() },
                    React.createElement(react_router_dom_1.Route, { exact: true, path: '/#hello' },
                        React.createElement("div", null,
                            React.createElement(Navbar_1.Navbar, null),
                            "this is the HELLO page :)")),
                    React.createElement(react_router_dom_1.Route, { exact: true, path: '/user' },
                        React.createElement("div", null,
                            React.createElement(Navbar_1.Navbar, null),
                            "this is the USER page")),
                    React.createElement(react_router_dom_1.Route, { exact: true, path: '/' },
                        React.createElement("div", null,
                            React.createElement("div", null,
                                React.createElement(Navbar_1.Navbar, null),
                                "this is the DEFAULT page.")))))));
    }
}
github jedireza / aqua / client / pages / main / app-universal.jsx View on Github external
const Footer = require('./footer.jsx');
const Home = require('./home/index.jsx');
const Login = require('./login/home/index.jsx');
const LoginForgot = require('./login/forgot/index.jsx');
const LoginLogout = require('./login/logout/index.jsx');
const LoginReset = require('./login/reset/index.jsx');
const Navbar = require('./navbar.jsx');
const NotFound = require('./not-found.jsx');
const React = require('react');
const ReactRouter = require('react-router-dom');
const RouteRedirect = require('../../components/route-redirect.jsx');
const Signup = require('./signup/index.jsx');


const Route = ReactRouter.Route;
const Switch = ReactRouter.Switch;


const AppUniversal = function () {

    return (
        <div>
            
            </div>
github joe-sky / nornj / packages / nornj-react / dist / nornj-react-router.js View on Github external
var _nornj = require("nornj");

  var _reactRouterDom = require("react-router-dom");

  (0, _nornj.registerComponent)({
    BrowserRouter: _reactRouterDom.BrowserRouter,
    HashRouter: _reactRouterDom.HashRouter,
    'router-Link': _reactRouterDom.Link,
    MemoryRouter: _reactRouterDom.MemoryRouter,
    'router-NavLink': _reactRouterDom.NavLink,
    'router-Prompt': _reactRouterDom.Prompt,
    Redirect: _reactRouterDom.Redirect,
    Route: _reactRouterDom.Route,
    Router: _reactRouterDom.Router,
    StaticRouter: _reactRouterDom.StaticRouter,
    'router-Switch': _reactRouterDom.Switch
  });

})));
github jedireza / aqua / client / pages / login / app.jsx View on Github external
'use strict';
const Forgot = require('./forgot/index.jsx');
const Home = require('./home/index.jsx');
const Logout = require('./logout/index.jsx');
const NotFound = require('./not-found.jsx');
const React = require('react');
const ReactRouter = require('react-router-dom');
const Reset = require('./reset/index.jsx');


const Route = ReactRouter.Route;
const Router = ReactRouter.BrowserRouter;
const Switch = ReactRouter.Switch;


const App = (
    
        
    
);


module.exports = App;
github Asing1001 / movieRater.React / dist / app / components / app.js View on Github external
render() {
        return (React.createElement(MuiThemeProvider_1.default, { muiTheme: this.muiTheme },
            React.createElement("div", null,
                React.createElement(appBarNormal_1.default, { className: this.state.searching && "vanish", onSearchIconClick: this.handleSearchToggle.bind(this), switchSorting: (sortType) => this.setState({ sortFunction: sorting_1.getSortFunction(sortType) }) }),
                React.createElement(appBarSearching_1.default, { className: !this.state.searching && "vanish", onBackSpaceIconClick: this.handleSearchToggle.bind(this) }),
                React.createElement("div", { className: "container", style: { marginTop: '.5em' } },
                    React.createElement(react_router_dom_1.Switch, null,
                        React.createElement(react_router_dom_1.Route, { exact: true, path: "/", render: (props) => React.createElement(movieList_1.default, Object.assign({}, props, { sortFunction: this.state.sortFunction })) }),
                        React.createElement(react_router_dom_1.Route, { path: "/upcoming", render: (props) => React.createElement(movieList_1.default, Object.assign({}, props, { sortFunction: this.state.sortFunction })) }),
                        React.createElement(react_router_dom_1.Route, { path: "/movie/:id", component: movieDetailTabs_1.default }),
                        React.createElement(react_router_dom_1.Route, { path: "/movies/:ids", render: (props) => React.createElement(movieList_1.default, Object.assign({}, props, { sortFunction: this.state.sortFunction })) }),
                        React.createElement(react_router_dom_1.Route, { path: "/movienotfound/:query", component: movieNotFound_1.default }),
                        React.createElement(react_router_dom_1.Route, { path: "/theaters", component: theaterList_1.default }),
                        React.createElement(react_router_dom_1.Route, { path: "/theater/:name", render: (props) => React.createElement(theaterDetail_1.default, Object.assign({}, props, { sortFunction: this.state.sortFunction })) }),
                        React.createElement(react_router_dom_1.Route, { component: pageNotFound_1.default }))))));
    }
}