How do you pull info from localStorage and display it in your electron app?



I’m working on a simple bookmark application and I want to implement localStorage so that the links will persist when reopening the application.

My application has an index.html file with the following template in it:

<template id="link-template">
      <article class="link">
        <h3 class="link--title"></h3>
        <p><a href="#" class="link--url"></a></p>

When I console.log(localStorage) inside my render.js file I get the following output in my Electron Inspector console:
Storage {Atom Discussion: "", Google: "", length: 2}
so localstorage is working correctly.

My issue is that I’m not sure how to manipulate with the template so that when the app starts, data from the localStorage will get rendered using the template in my index.html.

Any help is more than appreciated, thank you so so much!


Is there anything that I can add to make the question more clear?


I recommend using Dexie and storing your data in IndexedDB.


The example from the spec makes it look like you would manipulate the template the same way you typically manipulate the DOM; el.textContent, el.appendChild etc.

I’m not sure this question is Electron specific enough to make sense in this forum.