I'm trying to store an array that holds DOM elemenst into localStorage. I can't append the elements I store in the array when storing/getting it from localStorage. But currently, my program works if I don't use localStorage, and I can append the array elements completely fine. Here's an example I just quickly wrote up which would lead to an error for me when using localStorage. What is the cause for this error?
**html**
<div class = "container">
<div class = "stuff"> Store this text </div>
</div>
<div class = "storeHere">
**index.js**
let arr = [];
if (localStorage.length == 0) localStorage.setItem("arr", JSON.stringify(arr));
else {
//psuedocode: Calling the imported method in "other.js"
}
**other.js**
method() {
let temp = [];
temp = JSON.parse(localStorage.getItem("arr"));
temp.push(document.querySelector(".stuff");
localStorage.setItem("arr", JSON.stringify(temp));
const storeHere = document.querySelector(".storeHere");
storeHere.appendChild(temp[0]); //Error, not of type Node
}