{"id":338695,"date":"2017-04-19T03:30:40","date_gmt":"2017-04-18T19:30:40","guid":{"rendered":"http:\/\/techcrunch.com\/?p=1477331"},"modified":"2017-04-19T03:30:40","modified_gmt":"2017-04-18T19:30:40","slug":"facebook-announces-react-fiber-a-rewrite-of-its-react-framework","status":"publish","type":"post","link":"https:\/\/people.utm.my\/asmawisham\/facebook-announces-react-fiber-a-rewrite-of-its-react-framework\/","title":{"rendered":"Facebook announces React Fiber, a rewrite of its React framework"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/tctechcrunch2011.files.wordpress.com\/2017\/04\/image-uploaded-from-ios-1.jpg?w=738\" class=\"\"\/><\/p>\n<p>Facebook has completely rewritten <a target=\"_blank\" href=\"https:\/\/facebook.github.io\/react\/\">React<\/a>, its popular JavaScript library for building user interfaces. The company hasn\u2019t previously talked much about React Fiber, as the project is called, but it has actually been working on it for a while. It\u2019s now ready to talk about this project publicly in more detail (after word about it started spreading last year) and the plan is to put this rewrite into the hands of developers once React 16.0 launches later this year. It\u2019s already in use on Facebook.com today, which clearly indicates that Facebook itself thinks it\u2019s ready for prime time.<\/p>\n<p>In addition, it is also launching a rewrite of Relay, its framework for building data-heavy applications.<\/p>\n<h2>React Fiber<\/h2>\n<p>The idea behind React Fiber, the company tells me, is to take what the company has learned from developing React the first time around and put that into an updated framework that is still fully backwards compatible with existing React-based applications. React Fiber, Facebook tells me, will become the foundation of any future improvements and feature development of\u00a0the React framework.<\/p>\n<p>The main focus here was to make React as responsive as possible, Facebook engineer \u2014 and member of the React core team \u2014 Ben Alpert\u00a0told me\u00a0in an interview earlier this week. \u201cWhen we develop React, we\u2019re always looking to see how we can help developers build high-quality apps quicker,\u201d he noted. \u201cWe want to make it easier to make apps that perform very well and make them responsive.\u201d<\/p>\n<p>In light of this theme, it\u2019s no surprise that the highlights of this new release are built-in primitives for scheduling and incremental rendering. \u201cWe want to make sure we render the right stuff at the right time,\u201d Alpert\u00a0said, and added that \u201cresponsiveness was a huge push here.\u201d<\/p>\n<p>But why rewrite React from scratch? \u201cIt was not necessarily that the old code base was bad, but we wanted to start with a new foundation that could power everything we do going forward,\u201d Alpert said. That means the new code was developed from the ground up to be extensible, for example.<\/p>\n<p>Alpert stressed that React Fiber will be backward compatible, though as with all major React updates, there will be a few small breaking changes. The team says it doesn\u2019t anticipate that these will be problematic for developers, though. \u201cWe always had a strong API contract, so that gives us the flexibility to reimplement,\u201d he added.<\/p>\n<h2>Relay Modern<\/h2>\n<p><a target=\"_blank\" href=\"https:\/\/tctechcrunch2011.files.wordpress.com\/2017\/04\/relay_modern.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignright wp-image-1478268\" src=\"https:\/\/tctechcrunch2011.files.wordpress.com\/2017\/04\/relay_modern.png?w=348&#038;h=219\" alt=\"\" width=\"348\" height=\"219\" srcset=\"https:\/\/tctechcrunch2011.files.wordpress.com\/2017\/04\/relay_modern.png?w=348&#038;h=219 348w, https:\/\/tctechcrunch2011.files.wordpress.com\/2017\/04\/relay_modern.png?w=150&#038;h=94 150w, https:\/\/tctechcrunch2011.files.wordpress.com\/2017\/04\/relay_modern.png?w=300&#038;h=189 300w, https:\/\/tctechcrunch2011.files.wordpress.com\/2017\/04\/relay_modern.png 483w\" sizes=\"(max-width: 348px) 100vw, 348px\"\/><\/a>As Facebook also today announced, Relay \u2014 the company\u2019s JavaScript framework for building data-driven applications \u2014\u00a0has also been rewritten with a similar emphasis on performance and extensibility. Relay combines React with Facebook\u2019s GraphQL query language and now Relay Modern, as the company calls this rewrite, is meant to push this concept further and overcome some of the limitations of the original design. That also meant simplifying some of the design to\u00a0enhance the overall performance of the framework. \u201cRelay Modern retains the best parts of Relay \u2014 colocated data and view definitions, declarative data fetching \u2014 while also simplifying the API, adding features, improving performance, and reducing the size of the framework,\u201d the team explains in today\u2019s announcement. To do this, the team implemented a number of changes, but most importantly, it adopted static queries and ahead-of-time optimizations.<\/p>\n<p>Static queries essentially ensure that complex queries that aren\u2019t altered by runtime conditions can be pre-built and offloaded to Facebook\u2019s servers. So instead of sending complex queries across the network, all an application has to send is a string that identifies the pre-set query and the variables needed to complete it. Related to this, the ahead-of-time optimization feature in the Relay compiler now looks at the query structure to optimize the query that is now stored on the server to execute it faster \u2014 and hence return results to the user faster, too. Other new features in React Modern include built-in garbage collection, for example.<\/p>\n<p>For developers who are already using an older version of Relay, Relay Modern comes with a compatibility API.<\/p>\n<p>Facebook says that when its teams switched the Marketplace tab in the Facebook app from Relay to Relay Modern, the time to interaction on Android improved by an average of 900ms. While that doesn\u2019t sound like much, every second on mobile counts, and that\u2019s enough to make an application feel noticeably more\u00a0responsive than before.<\/p>\n","protected":false},"excerpt":{"rendered":"<p><img loading=\"lazy\" decoding=\"async\" width=\"680\" height=\"510\" src=\"https:\/\/tctechcrunch2011.files.wordpress.com\/2017\/04\/image-uploaded-from-ios-1.jpg?w=680\" class=\"attachment-large size-large wp-post-image\" alt=\"\" srcset=\"https:\/\/tctechcrunch2011.files.wordpress.com\/2017\/04\/image-uploaded-from-ios-1.jpg?w=680 680w, https:\/\/tctechcrunch2011.files.wordpress.com\/2017\/04\/image-uploaded-from-ios-1.jpg?w=1360 1360w, https:\/\/tctechcrunch2011.files.wordpress.com\/2017\/04\/image-uploaded-from-ios-1.jpg?w=150 150w, https:\/\/tctechcrunch2011.files.wordpress.com\/2017\/04\/image-uploaded-from-ios-1.jpg?w=300 300w, https:\/\/tctechcrunch2011.files.wordpress.com\/2017\/04\/image-uploaded-from-ios-1.jpg?w=768 768w\" sizes=\"(max-width: 680px) 100vw, 680px\" \/>&nbsp;Facebook has completely rewritten React, its popular JavaScript library for building user interfaces. The company hasn&#8217;t previously talked about React Fiber, as the project is called, but it has actually been working on it for a while. In addition, it is also launching a rewrite of Relay, its framework for building data-heavy applications. <a href=\"https:\/\/techcrunch.com\/2017\/04\/18\/facebook-announces-react-fiber-a-rewrite-of-its-react-framework\/?ncid=rss\">Read More<\/a><\/p>\n<div class=\"feedflare\">\n<a href=\"http:\/\/feeds.feedburner.com\/~ff\/Techcrunch?a=KOEHX1ao2Ng:vlr_Md0MORE:2mJPEYqXBVI\"><img decoding=\"async\" src=\"http:\/\/feeds.feedburner.com\/~ff\/Techcrunch?d=2mJPEYqXBVI\" border=\"0\"><\/img><\/a> <a href=\"http:\/\/feeds.feedburner.com\/~ff\/Techcrunch?a=KOEHX1ao2Ng:vlr_Md0MORE:7Q72WNTAKBA\"><img decoding=\"async\" src=\"http:\/\/feeds.feedburner.com\/~ff\/Techcrunch?d=7Q72WNTAKBA\" border=\"0\"><\/img><\/a> <a href=\"http:\/\/feeds.feedburner.com\/~ff\/Techcrunch?a=KOEHX1ao2Ng:vlr_Md0MORE:yIl2AUoC8zA\"><img decoding=\"async\" src=\"http:\/\/feeds.feedburner.com\/~ff\/Techcrunch?d=yIl2AUoC8zA\" border=\"0\"><\/img><\/a> <a href=\"http:\/\/feeds.feedburner.com\/~ff\/Techcrunch?a=KOEHX1ao2Ng:vlr_Md0MORE:-BTjWOF_DHI\"><img decoding=\"async\" src=\"http:\/\/feeds.feedburner.com\/~ff\/Techcrunch?i=KOEHX1ao2Ng:vlr_Md0MORE:-BTjWOF_DHI\" border=\"0\"><\/img><\/a> <a href=\"http:\/\/feeds.feedburner.com\/~ff\/Techcrunch?a=KOEHX1ao2Ng:vlr_Md0MORE:D7DqB2pKExk\"><img decoding=\"async\" src=\"http:\/\/feeds.feedburner.com\/~ff\/Techcrunch?i=KOEHX1ao2Ng:vlr_Md0MORE:D7DqB2pKExk\" border=\"0\"><\/img><\/a> <a href=\"http:\/\/feeds.feedburner.com\/~ff\/Techcrunch?a=KOEHX1ao2Ng:vlr_Md0MORE:qj6IDK7rITs\"><img decoding=\"async\" src=\"http:\/\/feeds.feedburner.com\/~ff\/Techcrunch?d=qj6IDK7rITs\" border=\"0\"><\/img><\/a>\n<\/div>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/feeds.feedburner.com\/~r\/Techcrunch\/~4\/KOEHX1ao2Ng\" height=\"1\" width=\"1\" alt=\"\"\/> <\/p>\n","protected":false},"author":5817,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[25],"tags":[59,66,26],"class_list":["post-338695","post","type-post","status-publish","format-standard","hentry","category-technology","tag-media","tag-techcrunch","tag-technology"],"_links":{"self":[{"href":"https:\/\/people.utm.my\/asmawisham\/wp-json\/wp\/v2\/posts\/338695","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/people.utm.my\/asmawisham\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/people.utm.my\/asmawisham\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/people.utm.my\/asmawisham\/wp-json\/wp\/v2\/users\/5817"}],"replies":[{"embeddable":true,"href":"https:\/\/people.utm.my\/asmawisham\/wp-json\/wp\/v2\/comments?post=338695"}],"version-history":[{"count":0,"href":"https:\/\/people.utm.my\/asmawisham\/wp-json\/wp\/v2\/posts\/338695\/revisions"}],"wp:attachment":[{"href":"https:\/\/people.utm.my\/asmawisham\/wp-json\/wp\/v2\/media?parent=338695"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/people.utm.my\/asmawisham\/wp-json\/wp\/v2\/categories?post=338695"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/people.utm.my\/asmawisham\/wp-json\/wp\/v2\/tags?post=338695"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}