This is a cool approach for keeping data synced with storage. I faced a similar problem a while ago and came up with a not too dissimilar solution though it's more of a wrapper for storage rather than a direct line in and out of it.
To be honest the idea is not mine I just refined the validation a little bit and wrote it using TypeScript. I didn't credit the original author because it was late and I was tired, but as soon as I find it I'll edit the post. 😅
Edit: I have updated the post with a link to the original article.
This is a cool approach for keeping data synced with storage. I faced a similar problem a while ago and came up with a not too dissimilar solution though it's more of a wrapper for storage rather than a direct line in and out of it.
React: Custom hook for accessing storage
Andrew Bone ・ Apr 21 '21 ・ 8 min read
To be honest the idea is not mine I just refined the validation a little bit and wrote it using TypeScript. I didn't credit the original author because it was late and I was tired, but as soon as I find it I'll edit the post. 😅
Edit: I have updated the post with a link to the original article.
Great article.