#

 

 

Mit Redirect kann man Seiten umleiten auf eine neue Adresse.

Dadurch kann man auch die Standard Startseite einer Webseite einstellen.

 

Code in der React App-Start-Datei App.js

App.js

<Route

 exact

 path="/"

 render={() => {

  return (

   <Redirect to="/📜" />

  )

 }}

 />

 

 

 

 

 

React Code App.js

import React, { Component } from 'react';

import { Route } from 'react-router';

import { Layout } from './components/Layout';

import { Articles } from './components/Articles';

import { Article } from './components/Article';

import { Edit } from './components/Edit';

import { Home } from './components/Home';

import ApiAuthorizationRoutes from './components/api-authorization/ApiAuthorizationRoutes';

import { ApplicationPaths } from './components/api-authorization/ApiAuthorizationConstants';

import { Redirect } from 'react-router'

 

import './custom.css'

 

export default class App extends Component {

    static displayName = App.name;

 

    render() {

        return (

            <Layout>               

                    <Route

                        exact

                        path="/"

                        render={() => {

                            return (

                                <Redirect to="/📜" />

                            )

                        }}

                    />

                <Route exact path='/' component={Articles} />

                <Route exact path='/📜' component={Articles} />

                <Route exact path='/👁/:id' component={Article} />

                <Route exact path='//:id' component={Edit} />

                <Route exact path='/home' component={Home} />

 

                <Route path={ApplicationPaths.ApiAuthorizationPrefix} component={ApiAuthorizationRoutes} />

            </Layout>

        );

    }

}

 

Mobile

.

0123movie.net