Shortfall of local storage
– Only store string data in localStorage, which are susceptible to XSS attacks, and it does not provide much functionality for querying data.

  1. IndexedDB is asynchronous, meaning it does not stop the user interface from rendering while the data loads.
  2. It allows you to categorise your data using object stores.
  3. It allows you to store large amounts of data.
  4. It supports objects like videos, images, and so on – any object that supports a structured clone algorithm.
  5. It supports database transactions and versioning.
  6. It has great performance.
  7. The database is private to an origin.
  8. It is supported on all modern browsers.

when creating a Database, you will have to give the database a name and a version
react-indexed-db-hook is forked from react-indexed-db. This library is a wrapper around the browser’s IndexedDB database in an “easier to use” React Hook.