Answer the question
In order to leave comments, you need to log in
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>
const indexPage = Loadable({
loader: () => import('../FrontComponents/IndexPage'),
loading: Preloader
})
...
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question