TNG-Hooks icon indicating copy to clipboard operation
TNG-Hooks copied to clipboard

Feature: `useDeferred()`

Open getify opened this issue 6 years ago • 0 comments

The useDeferred() hook creates and stores in a state slot (via useState(..)) an object, commonly called a deferred, which is a promise and also its resolve(..) / reject(..) capabilities.

function foo() {
   var { pr, resolve, reject } = useDeferred();
}

Unclear if there's any pattern that would benefit from passing a value to useDeferred(..). Need to further consider.

getify avatar Jan 18 '19 20:01 getify