Jump to content

React (JavaScript library): Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
fix my last edit cites
→‎History: Updates for more neutral language.
Line 27: Line 27:
<blockquote>''"The license granted hereunder will terminate, automatically and without notice, if you (or any of your subsidiaries, corporate affiliates or agents) initiate directly or indirectly, or take a direct financial interest in, any Patent Assertion: (i) against Facebook or any of its subsidiaries or corporate affiliates, (ii) against any party if such Patent Assertion arises in whole or in part from any software, technology, product or service of Facebook or any of its subsidiaries or corporate affiliates, or (iii) against any party relating to the Software. [...] A "Patent Assertion" is any lawsuit or other action alleging direct, indirect, or contributory infringement or inducement to infringe any patent, including a cross-claim or counterclaim."<ref>{{cite web|title=Additional Grant of Patent Rights Version 2|url=https://github.com/facebook/react/blob/b8ba8c83f318b84e42933f6928f231dc0918f864/PATENTS|website=GitHub}}</ref>''</blockquote>
<blockquote>''"The license granted hereunder will terminate, automatically and without notice, if you (or any of your subsidiaries, corporate affiliates or agents) initiate directly or indirectly, or take a direct financial interest in, any Patent Assertion: (i) against Facebook or any of its subsidiaries or corporate affiliates, (ii) against any party if such Patent Assertion arises in whole or in part from any software, technology, product or service of Facebook or any of its subsidiaries or corporate affiliates, or (iii) against any party relating to the Software. [...] A "Patent Assertion" is any lawsuit or other action alleging direct, indirect, or contributory infringement or inducement to infringe any patent, including a cross-claim or counterclaim."<ref>{{cite web|title=Additional Grant of Patent Rights Version 2|url=https://github.com/facebook/react/blob/b8ba8c83f318b84e42933f6928f231dc0918f864/PATENTS|website=GitHub}}</ref>''</blockquote>


This unconventional clause caused some controversy and debate in the React user community, since it seems to empower Facebook to revoke the license in all sorts of scenarios, e.g. if Facebook sues the licensee and they take "other action" by blogging about it. People expressed concerns that Facebook might unfairly exploit the termination clause, or that integrating React into a product might complicate a startup company's future acquisition.<ref>{{cite web|title=A compelling reason not to use ReactJS|first=Austin|last=Liu|url=https://medium.com/bits-and-pixels/a-compelling-reason-not-to-use-reactjs-beac24402f7b|website=Medium}}</ref> Google reportedly has forbidden its employees from using Facebook code with this license.<ref>{{cite web|first=Zellyn|last=Hunter|title=Hacker News: React Native is now open source|url=https://news.ycombinator.com/item?id=9271246|website=Y Combinator|access-date=9 December 2015}}</ref>
This unconventional clause caused some controversy and debate in the React user community, because it may be interpreted to empower Facebook to revoke the license in many scenarios, for example if Facebook sues the licensee prompting them to take "other action" by publishing the action on a blog or elsewhere. People expressed concerns that Facebook might unfairly exploit the termination clause, or that integrating React into a product might complicate a startup company's future acquisition.<ref>{{cite web|title=A compelling reason not to use ReactJS|first=Austin|last=Liu|url=https://medium.com/bits-and-pixels/a-compelling-reason-not-to-use-reactjs-beac24402f7b|website=Medium}}</ref> Google reportedly has forbidden its employees from using Facebook code with this license.<ref>{{cite web|first=Zellyn|last=Hunter|title=Hacker News: React Native is now open source|url=https://news.ycombinator.com/item?id=9271246|website=Y Combinator|access-date=9 December 2015}}</ref>


==Notable features==
==Notable features==

Revision as of 22:25, 19 December 2015

React
Original author(s)Jordan Walke
Developer(s)Facebook, Instagram and community
Initial release2013 (2013)
Stable release
0.14.3 / November 18, 2015; 8 years ago (2015-11-18)
Repository
Written inJavaScript
PlatformCross-platform
Size128 KiB production
559 KiB development
TypeJavaScript library
License3-Clause BSD with Facebook addendum (not OSI-approved)
Websitereactjs.com

React (sometimes styled React.js or ReactJS) is an open-source JavaScript library providing a view for data rendered as HTML. React views are typically rendered using components that contain additional components specified as custom HTML tags. React promises to programmers a model in which subcomponents cannot directly affect enclosing components ("data flows down"); efficient updating of the HTML document when data changes; and a clean separation between components on a modern single-page application.

It is maintained by Facebook, Instagram and a community of individual developers and corporations.[1][2][3] According to JavaScript analytics service Libscore, React is currently being used on the homepages of Imgur, Bleacher Report, Feedly, Airbnb, SeatGeek, HelloSign, and others.[4]

History

React was created by Jordan Walke, a software engineer at Facebook. He was influenced by XHP, an HTML components framework for PHP.[5]

The initial public release of React in May 2013 used a standard Apache License 2.0. In October 2014, React 0.12.0 replaced this with a 3-clause BSD license and added a separate PATENTS text file that permits usage of any Facebook patents related to the software.[6] However in April 2015, Facebook announced that they were clarifying this file to address confusion about it,[7] and React 0.13.1 introduced new language that effectively amends the BSD license terms in a nonstandard way:

"The license granted hereunder will terminate, automatically and without notice, if you (or any of your subsidiaries, corporate affiliates or agents) initiate directly or indirectly, or take a direct financial interest in, any Patent Assertion: (i) against Facebook or any of its subsidiaries or corporate affiliates, (ii) against any party if such Patent Assertion arises in whole or in part from any software, technology, product or service of Facebook or any of its subsidiaries or corporate affiliates, or (iii) against any party relating to the Software. [...] A "Patent Assertion" is any lawsuit or other action alleging direct, indirect, or contributory infringement or inducement to infringe any patent, including a cross-claim or counterclaim."[8]

This unconventional clause caused some controversy and debate in the React user community, because it may be interpreted to empower Facebook to revoke the license in many scenarios, for example if Facebook sues the licensee prompting them to take "other action" by publishing the action on a blog or elsewhere. People expressed concerns that Facebook might unfairly exploit the termination clause, or that integrating React into a product might complicate a startup company's future acquisition.[9] Google reportedly has forbidden its employees from using Facebook code with this license.[10]

Notable features

One-way data flow

Properties, a set of immutable values, are passed to a component's renderer as properties in its HTML tag. A component cannot modify any properties passed to it, but can be passed callback functions that do modify values. This mechanism promise is expressed as "properties flow down and actions flow up".

For example, a shopping cart component might include multiple product line components. Rendering a product line uses only the properties passed to it and cannot affect the shopping cart's total due. However, the product line could be passed a callback function as a property which would be called when a 'delete this product' button was pushed and that callback function could affect the total due.

Virtual DOM

Another notable feature is the use of a "virtual DOM." React renders to an in-memory data structure cache, computes the resulting differences, and then updates the browser's displayed DOM efficiently.[11][12] This allows the programmer to write code as if the entire page is rendered on each change while the React libraries only render subcomponents that actually change.

For example, a shopping cart component would be written to render the entire shopping cart on any change of data. If a product line subcomponent had no changes to the properties, a cached rendering would be used. This means the relatively slow update to the browser's DOM would be avoided. Alternately, if the product line quantity had changed, the product line subcomponent would be rendered; the resulting HTML might differ in only one node, and only that node would be updated in the browser's DOM.

JSX

React components are typically written in JSX, a JavaScript extension syntax allowing easy quoting of HTML and using HTML tag syntax to render subcomponents.[13] HTML syntax is processed into JavaScript calls of the React library. Developers may also write in pure JavaScript.

Architecture Beyond HTML

The basic architecture of React applies beyond rendering HTML in the browser. For example, Facebook has dynamic charts that render to <canvas> tags[14] and Netflix uses isomorphic loading to render identical HTML on both the server and client.[15][16]

React Native libraries announced by Facebook in 2015 [17] provide the React architecture to native IOS and Android applications.

Future Development

Project status can be tracked via the core team discussion forum. [18] However major changes to React go through the Future of React repo, Issues and PR.[19][20] This gives the React community a chance to give feedback on new potential feature and experimental APIs and JavaScript syntax.

Sub Projects

The status of the React sub projects is updated the project wiki.[21]

Facebook CLA

In order to contribute to React or any Facebook OS project one should fill the Facebook CLA. [22][23]

References

  1. ^ "React: Making faster, smoother UIs for data-driven Web apps". InfoWorld.
  2. ^ "Facebook's React JavaScript User Interfaces Library Receives Mixed Reviews". InfoQ.
  3. ^ "JavaScript's History and How it Led To ReactJS". The New Stack.
  4. ^ "Libscore". libscore.com.
  5. ^ "React (JS Library): How was the idea to develop React conceived and how many people worked on developing it and implementing it at Facebook?". Quora.
  6. ^ "React CHANGELOG.md". GitHub.
  7. ^ Pearce, James (10 April 2015). "Updating Our Open Source Patent Grant". code.facebook.com.
  8. ^ "Additional Grant of Patent Rights Version 2". GitHub.
  9. ^ Liu, Austin. "A compelling reason not to use ReactJS". Medium.
  10. ^ Hunter, Zellyn. "Hacker News: React Native is now open source". Y Combinator. Retrieved 9 December 2015.
  11. ^ "An Introduction to React.js". Instrument.
  12. ^ "Working With the Browser". React.
  13. ^ "JSX in Depth". Retrieved 2015-11-17.
  14. ^ https://facebook.github.io/react/blog/2013/06/05/why-react.html
  15. ^ "PayPal Isomorphic React".
  16. ^ "Netflix Isomorphic React".
  17. ^ https://code.facebook.com/posts/1014532261909640/react-native-bringing-modern-web-techniques-to-mobile/
  18. ^ "Meeting Notes". React Discuss. Retrieved 2015-12-13.
  19. ^ "reactjs/react-future - The Future of React". GitHub. Retrieved 2015-12-13.
  20. ^ "facebook/react - Feature request issues". GitHub. Retrieved 2015-12-13.
  21. ^ "facebook/react Projects wiki". GitHub. Retrieved 2015-12-13.
  22. ^ "facebook/react - CONTRIBUTING.md". GitHub. Retrieved 2015-12-13.
  23. ^ "Contributing to Facebook Projects". Facebook Code. Retrieved 2015-12-13.

External links