Saving state in localStorage.