A
A
askold20132018-05-16 18:39:35
React
askold2013, 2018-05-16 18:39:35

Why is the page not rendering after a React-Router redirect?

Hello!
I can't figure out why the redirect doesn't work correctly.
The problem is - the redirect works, then when necessary, the route changes, but instead of the page that corresponds to the changed route, the same redirect tag remains, that is, just an empty page.
Here is my router code (using BrowserRouter, version react-router-dom 4.0.8)

<Switch>
            <Route path='/' exact component = { indexPage } />
            <Route path='/category/:cat' component = { categoryPage } />
            <Route path='/article/:id' component = { articlePage } />
            <Route path='/signIn' component = { authForm }/>
            {
              this.props.isAuth ?
                adminPanels
                :
                <Redirect to='/signIn'/>
            }
            <Route component={ noMatch }/>
          </Switch>

Another feature is that the pages themselves are loaded using Loadable:
const indexPage = Loadable({
  loader: () => import('../FrontComponents/IndexPage'),
  loading: Preloader
})
...

What is the problem, who can tell? The redirect does not display the desired component, although the address changes

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question