store state in localStorage