I completed the Library project before, and now I wanted to implement Firebase for storage, but I’ve found it a little confusing.
I was trying to integrate Firebase with my JS logic for creating books and displaying them in my table, so that when a book object is created, it also creates a linked Firebase doc, but this started not to make sense to me. Why would I create a Firebase doc and a book object? What would be the point of having both?
Am I correct to think that if you are using Firebase, there’s no point in having a “book” object constructor?
For instance, my current JS functions like this:
- Book constructor creates book object
- Book objects stored in an array
- Function renders the array in my HTML
Now, if I’m going to create Firebase docs to be stored in a database, is there any point in still using the book constructor or the array? Wouldn’t that be unnecessary, when I could replace my previous code with:
- Function creates a new Firebase doc
- Firebase collection is rendered in my HTML
I’m trying to figure out if I’m missing something here, because this basically means that all of my previous code (and the whole point of the project, which was using constructors) will be invalidated and will have to be eliminated. Which I’m fine with doing, but I just wonder if I’m missing something.