gruns / gruns/ImmortalDB

Synchronous get / set?

Open
#51 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.1k
Forks
60
PR merge metrics
No merged PRs in 30d

Description

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:
```javascript
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

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.