How to use Local Storage with JavaScript
Web-Crunch
Hi, My name is Andy Leverenz and I work as a Product Designer at Dribbble. For fun, I design, code, and write. Check out my blog called Web-Crunch https://web-crunch.com where I publish design and development tutorials with the occasional vlog.
====================
Source Code ⚙️: https://github.com/justalever/local-storage-comments
It has been a bit since I did another Let’s Build: With JavaScript so I’m back with a new one focusing in on using Local Storage.
As a precursor to this tutorial I highly recommend not using local storage for comment data as I’m about to show you but rather more for small key-value assignments. For example, say you display a notification prompt, email subscription prompt, or alert of some kind on your site. You can hook into the browsers local storage API to save whether or not a given user wants to see these things as they display on your site.
That all could take place with a click event with JavaScript.
This tutorial goes one step further to show a proof of concept around adding a new comment to an existing comment feed. This in no way is complete but gives you an overview of how to both append new data to the DOM as well as store that data with local storage.
I invite you to extend this code to allow the commenter to delete their comments from local storage as well.
Continue reading here: https://web-crunch.com/how-to-use-local-storage-with-javascript
====================
📰 Subscribe: https://www.youtube.com/user/webcrunchblog?sub_confirmation=1
💎🛤 NEW COURSE: HELLO RAILS - Get notified Https://hellorails.io
💻 Previously published at: https://web-crunch.com/how-to-use-local-storage-with-javascript
💻 Check out the blog: https://web-crunch.com
🦄 Check out my personal site: https://justalever.com
🚀 Links: Weekly Newsletter: https://web-crunch.com/subscribe Twitter: https://twitter.com/webcrunchblog Twitter(Personal Account): https://twitter.com/justalever Facebook: https://facebook.com/webcrunchblog Dribbble: https://dribbble.com/justalever Github: https://github.com/justalever Medium: https://medium.com/the-web-crunch-publication
📘Check out my book on UX Design: "LUXD: Learn User Experience Design" https://web-crunch.com/books/luxd
📙 Check out my FREE book on Tumblr Theming: "Pro Tumblr Theming" https://web-crunch.com/books/ptt
💯 Need awesome web hosting? Check out cloudways. They allow me to use a variety of hosting providers and build apps with ease: http://bit.ly/webcrunchhosting
🌊 Need more advanced hosting for Rails, PHP, Node, or other projects? Digital Ocean has you covered. https://m.do.co/c/ee243ee15648
💎 Ruby on Rails devs, Try HatchBox.io. You'll save upwards of 50% compared to Heroku. I use it and love it! https://hatchbox.io/?via=andy
☕️ Or buy me a coffee https://www.buymeacoffee.com/webcrunch ... https://www.youtube.com/watch?v=AfVUiQ-my4Q
111689289 Bytes