This course is out of date and does not reflect our standards or industry best practices.

Check out a free preview of the full Electron Fundamentals, v2 course:
The "Deleting Persistent Data" Lesson is part of the full, Electron Fundamentals, v2 course featured in this preview video. Here's what you'd learn in this lesson:

Steve codes functionality into the app to allow users to delete entries in the database.

Get Unlimited Access Now

Transcript from the "Deleting Persistent Data" Lesson

>> Steve Kinney: One thing though that I have slight problem with is that there's no way to ever clear out this database right now, right? And yeah sure, they write limits and all sorts of stuff like that. Absolutely, and I'll leave that all up as an exercise to the reader.

[00:00:16] But at the very least it'd be cool to be able to either update or remove a clipping. Let's go ahead and we'll add a remove button.
>> Steve Kinney: Cool so in the clipping, add another button,
>> Steve Kinney: Just make sure I can remember my own CSS. So now I can hover it and I see this fancy remove button.

[00:00:50] And we'll go ahead and say this time we're gonna start passing in the ID as well so we can do stuff in the clipping itself. So we'll say ID,
>> Steve Kinney: Cool, and we'll go ahead and we can actually even put it up here.
>> Steve Kinney: We'll actually give it a,

>> Steve Kinney: onRemove we'll say database.where id is that current id, delete it.
>> Steve Kinney: I could break that out into its own thing, but let's make sure it works first. So we'll say say, onRemove,
>> Steve Kinney: When I click that button,
>> Steve Kinney: I'll say on remove id.
>> Steve Kinney: Clippings.
>> Steve Kinney: Let's give ourselves one here.

[00:02:53] We'll say const remove.
>> Steve Kinney: Make sure it's getting called, and then we'll go ahead and say yeah.
>> Speaker 2: I think you removed it, you just didn't refresh the-
>> Steve Kinney: Yeah.
>> Steve Kinney: That should have done the, it's the, with the arrow function, it's probably bound wrong.
>> Steve Kinney: Let's go ahead, let me grab this and say.

>> Steve Kinney: Because I can't spell. There we go, missing the i in clippings. So, if you miss it on the object that is undefined and React doesn't call undefined as a function.
>> Steve Kinney: So spelling is important is what we all learned together as a group.