An example of using Ionic Storage with React
new Storage()
with config using Driverscreate()
set()
get()
remove()
clear()
- Some custom functions for accessing arrays of objects
Based on the "list" Ionic React starter template
-
All
@ionic/storage
functionality is inIonicStorage.js
within the data folder -
Pass any name to the
createStore
function to name your DB -
Mimic of data fetching from
messages.js
just like in the list starter template -
Fetched data is placed into Ionic Storage then manipulated throughout
-
Upon "refresh", if the
msgs
key exists in Ionic Storage, this will be used instead of fetching
To reset: within DevTools > Application, delete the IndexedDB created. It will then be re-created and populated with fetched data.
Are you on Twitter? Lets connect @93alan