Very helpful package! Thank you.
I'm using ImmortalDB with React to save some page state to local.
I would like to init a component's state by loading locally stored state, like:
const MyComponent = () => {
const [state, setState] = useState(() => {
return ImmortalDB.get('key')
})
}
But ImmortalDB.get returns a Promise, so the above line would be return await ImmortalDB.get('key').
And React's useState does not support async functions,
so a synchronous get would be very helpful
Very helpful package! Thank you.
I'm using
ImmortalDBwith React to save some page state to local.I would like to init a component's state by loading locally stored state, like:
But
ImmortalDB.getreturns a Promise, so the above line would bereturn await ImmortalDB.get('key').And React's
useStatedoes not support async functions,so a synchronous
getwould be very helpful