getify/TNG-Hooks

Feature: `useDeferred()`

开放

#17 创建于 2019年1月18日

 (0 条评论) (0 个反应) (0 位负责人)JavaScript (43 个派生)batch import
enhancementhelp wantedquestion

仓库指标

星标
 (1,014 个星标)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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.

贡献者指南