对于空函数的用途是什么,然后第二个参数(promise.then)?

发布于 2025-02-07 18:24:03 字数 315 浏览 1 评论 0原文

我在大项目中找到一些代码:

const handlePay = () => {
    someFunction()
      .then(unwrapResult)
      .then(
        () => history.push(
          authorizedRoutes.accruals.payment.link
        ),
        () => {} /* what is it??? */
      );

我不明白此代码的内容:()=> {}

I find in big project some code:

const handlePay = () => {
    someFunction()
      .then(unwrapResult)
      .then(
        () => history.push(
          authorizedRoutes.accruals.payment.link
        ),
        () => {} /* what is it??? */
      );

I dont understand for what this code: () => {}

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

尽揽少女心 2025-02-14 18:24:03

这是一个更仔细的查看then()

p.then(function(value) {
   // fulfillment
  }, function(reason) {
  // rejection
});

它的reccept

https://developer.mozilla.org/de/docs/web/javascript/reference/global_objects/promise/promise/then

Here is a closer look at .then()

p.then(function(value) {
   // fulfillment
  }, function(reason) {
  // rejection
});

Its the reject

https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Promise/then

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文