Angular 2 Retain data on page reload

questionsAngular 2 Retain data on page reload
jyoti asked 3 years ago

inĀ Angular 2 how can we retain data on page reload? for example:
In my Angular 2 app, I pass in some data to a PageComponent from my HomeComponent which is then saved to a variable inside the PageComponent. Now when I refresh the page I need this data to be retained. Currently I am using session storage, but I was wondering if there is a better way to implement this.