We have included a helper function redrawTodosUI
that takes an array of todos to display, so all we need to do is read the todos from the database. Here we will simply read all the documents using db.allDocs
. The include_docs
option tells PouchDB to give us the data within each document, and the descending
option tells PouchDB how to order the results based on their _id
field, giving us newest first.
Once you have included this code, you should be able to refresh the page to see any todos you have entered.