previously we were only persisting the last route but this caused the back button to disappear when the page was refreshed. Hence, I have added history persistence as well.
This can probably be optimized a little bit more.
Known Issue: JSON.stringify doesn't preserve the route component so we have to retrieve it manually using `this.getRoute(key).component`.