Skip to content

Passing an async function to useCallback with more than one parameter results in a non-async function #89

@lozlow

Description

@lozlow

Hi there,

I noticed that when passing this async function:

let onSubmit = React.useCallback(async (_a, _b) => {
    await Promise.resolve()
})

it results in the following JS code which does not compile as the function is not async:

var onSubmit = React.useCallback(function (_a) {
      return function (_b) {
        return await Promise.resolve(undefined);
      };
    });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions