Storing state in localStorage
is a great way of improving UX, so that a user can pick up where they left off when returning to an application. With React hooks, it’s super easy to abstract this functionality so it can be reused anywhere. In this article, I am going to go over the implementation, and also show you how it can be tested.