3 ms·
I'm really excited about this release; I've contributed a couple of significant pieces of code to it and as you can see in the changelog, there are quite a few
by spicyj 13y ago
I'm really excited about this release; I've contributed a couple of significant pieces of code to it and as you can see in the changelog, there are quite a few framework improvements in this release.
If you're interested, I wrote up a post about my first experiences (first Reactions?) about a month ago:
http://benalpert.com/2013/06/09/using-react-to-speed-up-khan-academy.html http://benalpert.com/2013/06/09/using-react-to-speed-up-khan...
React is awesome. :) Proud to be a contributor.
- cliveowen 13y agoCan you briefly explain what actually is React? I read the first blog post by the Facebook team and then the website but still couldn't figure out what's the purpose/use cases.
- chenglou 13y agoReact reduces manual interaction with DOM (which is slow) by calculating the diff between your new render call and the previous one. Imagine building a webapp where each time you need to update the view, you just lazily refresh the whole UI. The library knows to only update the necessary parts. In fact, the whole api is so simple that I could probably summarize the core for you: - a `render` method that defines what the view looks like, using variables and such. - a `setState({variableName, newValue})` call, upon which the render method is called again, but only making DOM modifications where your variable influenced them.
- spicyj 13y agoWith Backbone views (for example), it's usually cumbersome to update certain pieces of a view to make sure they stay in sync with your underlying model data. You can just reset the HTML from scratch using something like a Handlebars template (or even just building the HTML by hand), but if you have a large DOM tree, that's slow because the browser needs to recreate all the nodes. Alternatively, you can look up each piece of the UI using jQuery and update it by hand (like $(".points").text(newPoints)), but that's cumbersome because you now have to define what the UI looks like in two places (once in the initial render, once in the update function) where they can get out of sync. React lets you define interfaces declaratively (as if you were just recreating all the HTML each time) but uses a fast internal representation of the DOM that it diffs against the previous copy so that it knows exactly when and how to modify the DOM, keeping things fast.
- cliveowen 13y agoThank the both of you, that explained everything. I'll check it out ;)