What is the trade off between history push and replace?
Solution 1:
I think you have the right idea.
I personally use .replace
when redirecting from an invalid url (or non relevant, i.e. redirect to "profile" page when a logged user goes to the "/login" url), so using the browser's "back" button works properly for the end user.
Solution 2:
router.replace acts like router.push, the only difference is that it navigates without pushing a new history entry, as its name suggests - it replaces the current entry.