The <Redirect>
tag can be used, to redirect to another route from within React render method. How can I do the same within a React component method like ?
componentDidMount
?
Asked
Active
Viewed 1,009 times
-1

Oblomov
- 8,953
- 22
- 60
- 106
1 Answers
-1
You can import history and use history.push to programatically navigate your React Router project in lifecycle methods or methods.

Win
- 5,498
- 2
- 15
- 20