Last active
July 19, 2020 13:06
-
-
Save ANUPAMCHAUDHARY1117/968b2dcfc4f4798937ee002f586924a5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect } from 'react'; | |
import IndexedDb from './indexedDb' | |
const Test = () => { | |
useEffect(() => { | |
const runIndexDb = async () => { | |
const indexedDb = new IndexedDb('test'); | |
await indexedDb.createObjectStore(['books', 'students']); | |
await indexedDb.putValue('books', { name: 'A Game of Thrones' }); | |
await indexedDb.putBulkValue('books', [{ name: 'A Song of Fire and Ice' }, { name: 'Harry Potter and the Chamber of Secrets' }]); | |
await indexedDb.getValue('books', 1); | |
await indexedDb.getAllValue('books'); | |
await indexedDb.deleteValue('books', 1); | |
} | |
runIndexDb(); | |
}, []); | |
return (<React.Fragment></React.Fragment>) | |
} | |
export default Test; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment