Arrays 如何在ReactJs中获取JSON url中的类别

Arrays 如何在ReactJs中获取JSON url中的类别,arrays,json,reactjs,object,Arrays,Json,Reactjs,Object,如何在ReactJs中获取JSON url中的类别 网址是 您可以使用许多ajax调用库。但现代浏览器支持的本机方式是使用fetchapi。它将为您提供json,您可以根据需要进行处理。下面是一个小例子。到目前为止,由于跨源,我无法在这里的编辑器中复制。但是代码是这样的 fetch("https://s3.ap-south-1.amazonaws.com/scapic-others/json/models.json") .then(res => res.json()) .t

如何在ReactJs中获取JSON url中的类别 网址是

您可以使用许多ajax调用库。但现代浏览器支持的本机方式是使用fetchapi。它将为您提供json,您可以根据需要进行处理。下面是一个小例子。到目前为止,由于跨源,我无法在这里的编辑器中复制。但是代码是这样的

fetch("https://s3.ap-south-1.amazonaws.com/scapic-others/json/models.json")
    .then(res => res.json())
    .then(resultAns => { console.log(resultAns)})

您可以使用许多ajax调用库。但现代浏览器支持的本机方式是使用fetchapi。它将为您提供json,您可以根据需要进行处理。下面是一个小例子。到目前为止,由于跨源,我无法在这里的编辑器中复制。但是代码是这样的

fetch("https://s3.ap-south-1.amazonaws.com/scapic-others/json/models.json")
    .then(res => res.json())
    .then(resultAns => { console.log(resultAns)})
可能的重复可能的重复