<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Anshuman  Tiwari</title>
    <description>The latest articles on DEV Community by Anshuman  Tiwari (@officialanshumantiwari).</description>
    <link>https://dev.to/officialanshumantiwari</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F894568%2F7f600a09-cb84-4e6a-aefe-56c331d28ba3.jpeg</url>
      <title>DEV Community: Anshuman  Tiwari</title>
      <link>https://dev.to/officialanshumantiwari</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/officialanshumantiwari"/>
    <language>en</language>
    <item>
      <title>Help me with my code I'm trying to delete data from firebase but I'm getting reference error</title>
      <dc:creator>Anshuman  Tiwari</dc:creator>
      <pubDate>Sat, 19 Nov 2022 06:28:47 +0000</pubDate>
      <link>https://dev.to/officialanshumantiwari/help-me-with-my-code-im-trying-to-delete-data-from-firebase-but-im-getting-reference-error-575o</link>
      <guid>https://dev.to/officialanshumantiwari/help-me-with-my-code-im-trying-to-delete-data-from-firebase-but-im-getting-reference-error-575o</guid>
      <description>&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;function showNotes(){
    let html = "";

    let notesElm = document.getElementById('notes');

    get(child(dbRef,"Notes")).then((snapshot) =&amp;gt; {
        var count = 0
        if (snapshot.exists()) {
            const noteData = snapshot.val()
            for (const item in noteData) {
                if (Object.hasOwnProperty.call(noteData, item)) {
                    const element = noteData[item];
                    html+=`
                    &amp;lt;div class="card mx-2 my-2 noteCard" style="width: 18rem;"&amp;gt;
                    &amp;lt;div class="card-body"&amp;gt;
                    &amp;lt;h5 class="card-title"&amp;gt;${element.title}&amp;lt;/h5&amp;gt;
                    &amp;lt;p class="card-text"&amp;gt;${element.text}&amp;lt;/p&amp;gt;
                    &amp;lt;button id=${count} onclick="deleteElement(${element.title})" class="btn btn-primary"&amp;gt;Delete Node&amp;lt;/button&amp;gt;
                    &amp;lt;/div&amp;gt;
                     &amp;lt;/div&amp;gt;
                     `;
                    }
                    count++
                }
                notesElm.innerHTML = html;
            } else {
                console.log("No data available");
            }
        }).catch((error) =&amp;gt; {
            console.error(error);
        });
} 
function deleteElement(item){
    remove(ref(db,"Notes/"+item))
    .then(()=&amp;gt;{
        console.log("Data has been removed")
    })
    .catch((err)=&amp;gt;{
        console.log(err);
    })
    window.location.reload()
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>firebase</category>
    </item>
  </channel>
</rss>
