首页 \ 问答 \ 从ReactJs中提取API中的数据(Extract data from API in ReactJs)

从ReactJs中提取API中的数据(Extract data from API in ReactJs)

class Rnn extends Component{
 constructor(props){
 super(props);
 this.state={
 x:[]
}
}

componentWillMount(){
 var api={
 getroverss(){
 var url="https://fcctop100.herokuapp.com/api/fccusers/top/recent";
 return fetch(url).then((res) => res.json());
}
},
 api.getrovers().then((res) =>{
 this.setState({ x: res
 })
 });
 }
 render(){
 var xx=this.state.x;
 console.table(xx);
 return (
  <h1>print data</h1>
  );
 }}

我一直在使用这个API从它获取数据。 我已经设法输出控制台上的数据。 如何获取(输出/打印)我网页上的数据? (我只想使用提取方法)。


class Rnn extends Component{
 constructor(props){
 super(props);
 this.state={
 x:[]
}
}

componentWillMount(){
 var api={
 getroverss(){
 var url="https://fcctop100.herokuapp.com/api/fccusers/top/recent";
 return fetch(url).then((res) => res.json());
}
},
 api.getrovers().then((res) =>{
 this.setState({ x: res
 })
 });
 }
 render(){
 var xx=this.state.x;
 console.table(xx);
 return (
  <h1>print data</h1>
  );
 }}

I have been using this api get data from it. I have managed to ouput the data on console. How do I get(ouput/print) the data on my webpage? (I want to use fetch method only).


原文:https://stackoverflow.com/questions/42871269
更新时间:2021-09-13 14:09

最满意答案

我建议您玩App Engine Cookbook,看看它是如何工作的。 它有一些非常好的例子,在尝试理解DataStore时帮助了我很多

http://appengine-cookbook.appspot.com/cat/?id=ahJhcHBlbmdpbmUtY29va2Jvb2tyFwsSCENhdGVnb3J5IglEYXRhc3RvcmUM


I would recommend having a play with the App Engine Cookbook to see how things work. It has some really good examples and has helped me a lot when trying to understand the DataStore

http://appengine-cookbook.appspot.com/cat/?id=ahJhcHBlbmdpbmUtY29va2Jvb2tyFwsSCENhdGVnb3J5IglEYXRhc3RvcmUM

相关问答

更多
  • 在复制上:您引用的答案是指跨Bigtable集群复制数据,目前尚不支持。 (例如,美国的Bigtable集群将其写入欧洲的第二个集群) 这个概念与Bigtable集群内的数据复制是分开的,这与HDFS中的复制类似,这是该产品今天绝对所做的事情。 在可用性方面:是的,Bigtable集群的可用性与Google云区的可用性有关。 关于独立性:是的,Cloud Bigtable集群跨区域独立。 一个区域的停电不应影响其他区域的可用性。 关于每个单元的数据:我们不拒绝每个单元写入大于10Mb的写入,我们将此集合作为 ...
  • 根据Datastore的经验和阅读BigTable 文档 ,主要区别在于: Bigtable似乎设计用于HBase兼容性,而Datastore更适用于Python / Java / Go Web应用程序开发人员(最初是App Engine) Bigtable比“数据存储”更“IaaS”,因为它不是“只在那里”,而是要配置一个集群。 Bigtable只支持一个索引 - “行键”(Datastore中的实体键) 这意味着查询位于Key上,与Datastore的索引属性不同 Bigtable仅在单个行上支持原子性 ...
  • 对于一个简单的Web框架,Webapp是一个很好的选择,但是还有很多其他简单的python web框架,它们都有在用例中设置它们的说明(cherrypy,web.py等)。 由于谷歌为gae开发了webapp,我不相信他们发布了在apache后面设置它的说明。 BigTable是Google专有的,因此您无法在本地运行它。 如果您正在寻找具有类似性能特征的东西,我会研究无模式的“面向文档的”数据库。 Webapp is a fine choice for a simple web framework but ...
  • 是的,例如在MongoDB中,您没有连接,因为它是非关系的 ,因此它确实改变了我们存储和浏览数据的方式。 由于MongoDB是非关系型(无连接),因此文档之间的引用(“外键”)通常通过对服务器的附加查询在客户端解析。 MongoDB中的引用通常有两种约定:第一种是简单的手动引用,第二种是DBRef标准,许多驱动程序都明确支持这种引用。 似乎共识是非规范化和复制以加速读取以避免加入分布式数据的成本,并且在应用程序级别上完成连接和合并逻辑。 至于是否绝对要求对数据库进行非规范化,我不确定(其他SO成员可能会启发 ...
  • 首先,如果您正在使用template.render ,那么您正在使用一个框架:GAE附带的最小“webapp”框架。 当然, template模块本身是Django模板库的一个薄包装器。 但是,包装器 - 它处理Django和webapp之间的一些不兼容性 - 不会公开直接从字符串呈现的方法。 它允许访问基本的django Template类,该类可用于直接从模板字符串实例化模板: tmpl = template.Template(template_string) tmpl.render(template. ...
  • 我建议您玩App Engine Cookbook,看看它是如何工作的。 它有一些非常好的例子,在尝试理解DataStore时帮助了我很多 http://appengine-cookbook.appspot.com/cat/?id=ahJhcHBlbmdpbmUtY29va2Jvb2tyFwsSCENhdGVnb3J5IglEYXRhc3RvcmUM I would recommend having a play with the App Engine Cookbook to see how things w ...
  • App Engine是一项区域服务: App Engine是区域性的,这意味着运行应用程序的基础架构位于特定区域,由Google管理,可在该区域内的所有区域中冗余使用。 从这里开始 。 您确实可以使用GKE或GCE,虽然这些不是像App Engine那样的托管服务,但它们都支持自动缩放。 App Engine is a regional service: App Engine is regional, which means the infrastructure that runs your apps is ...
  • 您可以使用香草DjangGAE来完成您提到的所有事情。 一个很好的起点 值得一提的是,有一些值得注意的局限性。 这些也列在我链接的网站上。 You can use vanilla DjangGAE to do everything you'd mentioned. A good starting point It's worth mentioning that there are a few notable limitations. Those are also listed in the site I'd ...
  • 数据存储区建立在Megastore之上, Megastore基于BigTable的实现。 在为appengine开发时,你并不需要关注Megastore和BigTable概念,因为它完全不受你的控制,无论如何数据存储都会在它们之上构建更多。 这就像在学习了BerkleyDB的实现方式之后尝试对MySQL数据进行建模....有趣但最终对您的应用程序没有用。 仔细阅读megastore论文,它可能会为您提供大部分内容,并查看一些提出High Replication数据存储区的Google IO会话,因为这些内容 ...
  • 您正在使用YSlow插件来衡量这一点,而YSlow告诉您网站为何缓慢(狡猾的名称是线索)。 例如,在gifttag.com的情况下,YSlow报告说: 该页面有9个外部Javascript脚本。 尝试将它们合并为一个。 该页面有3个外部样式表。 尝试将它们合并为一个。 此页面有13个外部背景图像。 尝试将它们与CSS精灵结合起来。 所以这是一个'E'级。 这将会破坏网站的感知负载性能。 这与Appengine没有任何关系。 You're using the YSlow plugin to measure t ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。