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.
- IndexedDB is asynchronous, meaning it does not stop the user interface from rendering while the data loads.
- It allows you to categorise your data using object stores.
- It allows you to store large amounts of data.
- It supports objects like videos, images, and so on – any object that supports a structured clone algorithm.
- It supports database transactions and versioning.
- It has great performance.
- The database is private to an origin.
- It is supported on all modern browsers.
when creating a Database, you will have to give the database a name and a version
https://www.freecodecamp.org/news/how-indexeddb-works-for-beginners/
https://www.w3.org/TR/IndexedDB/#introduction
https://www.npmjs.com/package/react-indexed-db
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.