So, react-router team is preferring <Redirect to="/asd/" /> component over imperative style history.push('/asd'). But, sometimes is just easier to use history.push() instead of rendering a redirect component. What's your thoughts?
I think it's the same as using hooks and functional components over class based components.
Although it's recommended, it's better to just stick to whatever you and your team is more comfortable with and what makes more sense to you.
In the end writing code that actually works and which you can easily understand later to further iterate is more important.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
So, react-router team is preferring
<Redirect to="/asd/" />
component over imperative stylehistory.push('/asd')
. But, sometimes is just easier to usehistory.push()
instead of rendering a redirect component. What's your thoughts?I think it's the same as using hooks and functional components over class based components.
Although it's recommended, it's better to just stick to whatever you and your team is more comfortable with and what makes more sense to you.
In the end writing code that actually works and which you can easily understand later to further iterate is more important.