【问题标题】:How to get the GITHUB ISSUES API using REACT如何使用 REACT 获取 GITHUB ISSUES API
【发布时间】:2023-01-07 20:27:49
【问题描述】:

我正在努力获取数据并显示它。不知道要使用的代码

我试试这个:

 function requestUserRepos() {
    return Promise.resolve(fetch(`https://api.github.com/issues`));
  }

  requestUserRepos()
    .then((res) => res.json())
    .then((data) => console.log(data));

但没有成功

【问题讨论】:

    标签: reactjs github-api


    【解决方案1】:

    端点格式可能不正确。假设您想要一个存储库的问题列表,格式为:

    https://api.github.com/repos/{owner}/{repo}/issues

     function requestUserRepos() {
        return Promise.resolve(fetch(`https://api.github.com/username/reponame/issues`));
      }
    
    ...
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-28
      • 2022-08-13
      • 2019-12-19
      • 1970-01-01
      • 2019-08-28
      • 2018-02-25
      相关资源
      最近更新 更多