react.js和Ajax之间的区别 [英] Difference between react.js and Ajax

查看:189
本文介绍了react.js和Ajax之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我搜索React.js时,我得到的是:React.js是一个用于创建用户界面的框架.如果网站的特定部分经常更新,则意味着我们可以使用react.但是我感到困惑的是,Ajax仅用于此目的.我们可以使用Ajax更新网站的一部分,而无需刷新页面.对于模板,我们将使用把手和胡须.有人可以解释一下我与Ajax有何不同之处以及为什么要使用它.

When I googled about React.js what I got is: React.js is a Framework that is used to create user interfaces. If a particular part of the website is frequently updated that means we can use react. But I am confused that Ajax has been used for this only. We can update a part of site using Ajax without page refresh. For templating we would be using handlebars and mustache. Could somebody explain me in what ways react is different from Ajax and why we should use it.

推荐答案

Ajax用于刷新网页,而不必重新加载它:它向服务器发送请求,但通常,响应由显示的javascript处理动态地在浏览器上添加一个新元素,而无需重新加载整个页面.

Ajax is used to refresh a web page without having to reload it : it sends a request to the server, but typically the response is processed by the javascript that displays dynamically a new element on the browser without having to reload the entire page.

React是一个javascript库,可使用界面组件动态更新页面.这些组件是通过javascript交互或通过服务器的ajax请求来计算的.因此,ReactJS也可以使用Ajax请求来更新页面.

React is a javascript library that dynamically update the page with inferface components. The components are calculated either by javascript interactions or by an ajax request that go through the server. So ReactJS can also use Ajax requests to update the page.

Mustache和Handlebars与ReactJS有点不同,因为其主要目标是转换将在页面中显示的组件中的模板.它还可以使用Ajax获取数据(用于获取模板或json数据).

Mustache and Handlebars are a bit different from ReactJS as the main goal is to transform a template in a component that will be displayed in a page. It can also use Ajax to get data (for getting templates or json datas).

这篇关于react.js和Ajax之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆