0

ライブラリ「node-fetch」を使い始めました。ドキュメントには、ライブラリの使用方法に関するいくつかの例があります。

fetch('https://api.github.com/users/github')
    .then(function(res) {
        return res.json();
    }).then(function(json) {
        console.log(json);
    });

すべての例は、連結された then-call のこのスタイルで書かれています。

1 回の then-call だけで完了できませんか?

このような?

fetch('https://api.github.com/users/github')
    .then(function(res) {
        console.log(res.json());
    });

複数の then-call を持つ利点は何ですか?

4

0 に答える 0