reim-task
import task from 'reim-task'reim-task creates a store that updates according to state of an async function
Exports
task
tasktask(fn: func) => Store
Creates a store from passed in async function.
The store will be updated with 3 stages
{status: 'initialized'} => {status: 'pending'} => {status: 'resolved', result } / {status: 'rejected', error}
To execute the function, you can use .exec
const aTask = task(() => {
await fetchSomething()
})
aTask.exec() // starts fetchingLast updated