I'm new to Javascript and am trying to wrap my head around what you would use different frameworks for. Would a person use React and jQuery in the same project? Do they compliment or compete with each other? If they compete, why would you use one over the other?
我是Javascript的新手,我正试图围绕你将使用不同框架的内容。一个人会在同一个项目中使用React和jQuery吗?他们互相恭维还是互相竞争?如果他们竞争,为什么你会使用一个而不是另一个?
1 个解决方案
#1
2
They are totally different things and ideas. Where React.JS is a framework that will be a replacement for the traditional view part in MVC.
它们是完全不同的东西和想法。其中React.JS是一个框架,它将取代MVC中的传统视图部分。
jQuery is more a helper than a framework. It's a bundle of handy functions that will abstract a lot of javascript to make it easier to interact with for example the DOM. Or do things like ajax requests.
jQuery更像是一个帮助器而不是一个框架。它是一组方便的函数,它们将抽象大量的javascript,以便更容易与DOM进行交互。或者像ajax请求那样做。
You could use jQuery and React.JS in the same project. Though it's not recommended to start changing the DOM with jQuery when you use React.JS because React.js uses an intelligent way to modify the DOM.
您可以在同一个项目中使用jQuery和React.JS。虽然在使用React.JS时不建议使用jQuery开始更改DOM,因为React.js使用智能方法来修改DOM。
What would be a possible scenario is that you use React.JS for the view part and jQuery to do the request to fetch information from the server.
可能的情况是您使用React.JS作为视图部分,jQuery执行从服务器获取信息的请求。
#1
2
They are totally different things and ideas. Where React.JS is a framework that will be a replacement for the traditional view part in MVC.
它们是完全不同的东西和想法。其中React.JS是一个框架,它将取代MVC中的传统视图部分。
jQuery is more a helper than a framework. It's a bundle of handy functions that will abstract a lot of javascript to make it easier to interact with for example the DOM. Or do things like ajax requests.
jQuery更像是一个帮助器而不是一个框架。它是一组方便的函数,它们将抽象大量的javascript,以便更容易与DOM进行交互。或者像ajax请求那样做。
You could use jQuery and React.JS in the same project. Though it's not recommended to start changing the DOM with jQuery when you use React.JS because React.js uses an intelligent way to modify the DOM.
您可以在同一个项目中使用jQuery和React.JS。虽然在使用React.JS时不建议使用jQuery开始更改DOM,因为React.js使用智能方法来修改DOM。
What would be a possible scenario is that you use React.JS for the view part and jQuery to do the request to fetch information from the server.
可能的情况是您使用React.JS作为视图部分,jQuery执行从服务器获取信息的请求。