How to use the react-router-dom.Redirect 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 alitajs / alita / packages / umi-plugin-cache-route / renderRoutes.js View on Github external
}), routes.map(function (route, i) {
    if (route.redirect) {
      return _react.default.createElement(_reactRouterDom.Redirect, {
        key: route.key || i,
        from: route.path,
        to: route.redirect,
        exact: route.exact,
        strict: route.strict
      });
    }

    var RouteRoute = route.Routes ? withRoutes(route) : RouteWithProps;
    return _react.default.createElement(RouteRoute, {
      key: route.key || i,
      path: route.path,
      exact: route.exact,
      strict: route.strict,
      sensitive: route.sensitive,
      keepAlive: route.keepAlive,
github coryhouse / react-flux-building-applications / src / components / authors / manageAuthorPage.js View on Github external
"use strict";

var React = require('react');
var createReactClass = require('create-react-class');
var ReactRouter = require('react-router-dom');
var AuthorForm = require('./authorForm');
var AuthorActions = require('../../actions/authorActions');
var AuthorStore = require('../../stores/authorStore');

var Redirect = ReactRouter.Redirect;
var Prompt = ReactRouter.Prompt;

var ManageAuthorPage = createReactClass({
	getInitialState: function() {
		return {
			author: { id: '', firstName: '', lastName: '' },
			errors: {},
			dirty: false,
			redirect: false
		};
	},

	componentDidMount: function() {
		var authorId = this.props.match.params.id; //from the path '/author:id'
		if (authorId) {
			this.setState({author: AuthorStore.getAuthorById(authorId) });
github joe-sky / nornj / packages / nornj-react / dist / nornj-react-router.js View on Github external
}((function () { 'use strict';

  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
  });

})));