Skip to content

[Docs] Feedback for “usePromise” #211

@DorijanH

Description

@DorijanH

While reading docs for the usePromise hook, I've noticed that in the Example with promise object section, the promise object is not directly passed to the hook, rather the function that returns a promise

Currently

function getItems() {
    return new Promise<number[]>((resolve) => {
        setTimeout(() => {
            resolve([1, 2, 3]);
        }, 1000);
    });
}
...
const { item, isLoading, error } = usePromise(getItems);

Expected

const { item, isLoading, error } = usePromise(getItems());

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingdocumentationImprovements or additions to documentationgood first issueGood for newcomers

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions