News for hackers. Stuff that matters.
Re:Why did we build React? by mwcampbell on Wednesday June 05, 2013 @01:12PM (#5827015)
Correct me if I'm wrong, but it looks like React reinvents some things that have been in jQuery for years, like cross-browser event handling and DOM utilities. Why not build on top of jQuery?
Re:Why did we build React? by spicyj on Wednesday June 05, 2013 @01:31PM (#5827159)
React does have a little overlap with jQuery but probably not as much as it might appear. jQuery isn't designed for writing components declaratively and then checking what's changed so it wouldn't simplify the React code much at all. (Plus, React is only 55% the size of jQuery.)
Re:Why did we build React? by mwcampbell on Wednesday June 05, 2013 @01:35PM (#5827203)
So how does one normally do Ajax in a React app? Use XHR directly?
Re:Why did we build React? by zpao on Wednesday June 05, 2013 @01:56PM (#5827344)
You're more than welcome to use XHR however you see fit. We don't dictate that choice. For many that will mean `$.ajax` - React plays nicely with jQuery (so long as you don't modify the DOM out from under us). For others that might mean a thin library that does that the same thing.

If you're interested in using jQuery with React, we have an example: https://github.com/facebook/react/tree/master/examples/jquer.... It doesn't use XHR but it should give you some idea of how the 2 can play nicely together.

Re:Why did we build React? by spicyj on Wednesday June 05, 2013 @01:39PM (#5827236)
I'm actually not sure. In a side project I'm building with React, we have been using jQuery (Zepto, actually) for XHR only and it would be nice to get rid of it completely.