Software:React Native

From HandWiki
Short description: Open-source mobile application framework
React Native
React-icon.svg
Developer(s)Meta and community
Initial releaseMarch 26, 2015; 9 years ago (2015-03-26)[1]
Repositoryhttps://github.com/facebook/react-native
Written inJavaScript, Java, C++, Objective-C, Python
PlatformAndroid, Android TV, iOS, macOS, tvOS, Web, Windows, UWP, and VR
TypeApplication framework
LicenseMIT License
Websitereactnative.dev

React Native is an open-source UI software framework created by Meta Platforms, Inc.[2] It is used to develop applications for Android[3]:{{{1}}},[4][5] Android TV,[6] iOS[3]:{{{1}}},[5] macOS,[7] tvOS,[8] Web,[9] Windows[7] and UWP[10] by enabling developers to use the React framework along with native platform capabilities.[11] It is used to develop the Android and iOS applications at Facebook, Microsoft, and Shopify.[12] It is also being used to develop virtual reality applications at Oculus.[13]

History

In 2012 Mark Zuckerberg commented, "The biggest mistake we made as a company was betting too much on HTML as opposed to native".[14][15] Using HTML5 for Facebook's mobile version resulted in an unstable application that retrieved data slowly.[16] He promised Facebook would soon deliver a better mobile experience.

Inside Facebook, Jordan Walke found a way to generate UI elements for iOS from a background JavaScript thread, which became the basis for the React web framework. They decided to organize an internal Hackathon to perfect this prototype in order to be able to build native apps with this technology.[17]

In 2015, after months of development, Facebook released the first version for the React JavaScript Configuration. During a technical talk,[18] Christopher Chedeau explained that Facebook was already using React Native in production for its Group App and its Ads Manager App.[19]

Implementation

The working principles of React Native are virtually identical to React except that React Native does not manipulate the DOM via the Virtual DOM.[3]:{{{1}}} It runs in a background process (which interprets the JavaScript written by the developers) directly on the end-device and communicates with the native[3]:{{{1}}} platform via serialized data over an asynchronous and batched bridge.[20][21]

React components wrap existing native code and interact with native APIs via React's declarative UI paradigm and JavaScript. TypeScript is often used over JavaScript in modern React Native applications due to its increased type safety. [22]

While React Native styling has a similar syntax to CSS, it does not use HTML or CSS.[3]:{{{1}}}[23] Instead, messages from the JavaScript thread are used to manipulate native views.

React Native is also available for both Windows and macOS, which is currently maintained by Microsoft.

Hello World example

A Hello, World program in React Native looks like this:

import { AppRegistry, Text, View, Button } from 'react-native';
import React from 'react';

const HelloWorldApp = () => {
  const [count, setCount] = React.useState(0);

  const incrementCount = () => {
    setCount((prevCount) => prevCount + 1);
  };

  return (
    <View>
      <Text>Hello world!</Text>
      <Text>{count}</Text>
      <Button onPress={incrementCount} title="Increase Count" />
    </View>
  );
};

export default HelloWorldApp;

AppRegistry.registerComponent('HelloWorld', () => HelloWorldApp);

See also

Citations

  1. "React Native: Bringing modern web techniques to mobile". 26 March 2015. https://code.fb.com/android/react-native-bringing-modern-web-techniques-to-mobile/. 
  2. "Chapter 1. What Is React Native?". O’Reilly Media, Inc.. https://www.oreilly.com/library/view/learning-react-native/9781491929049/ch01.html. 
  3. 3.0 3.1 3.2 3.3 3.4 Eisenman 2016.
  4. "Android Release for React Native". 14 September 2015. https://code.facebook.com/posts/1189117404435352/react-native-for-android-how-we-built-the-first-cross-platform-react-native-app/. 
  5. 5.0 5.1 Shankland, Stephen (March 29, 2018). "Mozilla's radical open-source move helped rewrite rules of tech". https://www.cnet.com/culture/mozilla-open-source-firefox-move-helped-rewrite-tech-rules-anniversary/. 
  6. "Building For TV Devices · React Native" (in en). https://reactnative.dev/. 
  7. 7.0 7.1 "React Native for Windows + macOS · Build native Windows & macOS apps with Javascript and React". https://microsoft.github.io/react-native-windows/. 
  8. "React Native for Apple TV" (in en-US). https://dlowder-salesforce.github.io/react-native-apple-tv/. 
  9. "React Native for Web". https://github.com/necolas/react-native-web/. 
  10. Windows Apps Team (April 13, 2016). "React Native on the Universal Windows Platform". https://blogs.windows.com/buildingapps/2016/04/13/react-native-on-the-universal-windows-platform/. 
  11. "Out-of-Tree Platforms". Facebook, Inc.. https://reactnative.dev/docs/out-of-tree-platforms. 
  12. "React Native Showcase" (in en). https://reactnative.dev/showcase.html. 
  13. "React Native in H2 2021 · React Native" (in en). https://reactnative.dev/blog/2021/08/19/h2-2021. 
  14. "Zuckerberg's Biggest Mistake? 'Betting on HTML5'". Mashable. https://mashable.com/2012/09/11/html5-biggest-mistake. 
  15. Zuckerberg, Mark (2012-09-12). "Fireside Chat With Facebook Founder and CEO Mark Zuckerberg". https://techcrunch.com/video/fireside-chat-with-facebook-founder-and-ceo-mark-zuckerberg/. 
  16. Warren, Christina. "Zuckerberg's Biggest Mistake? 'Betting on HTML5'" (in en). https://mashable.com/2012/09/11/html5-biggest-mistake/. 
  17. "A short Story about React Native". https://jobninja.com/blog/short-story-react-native/. 
  18. Christopher, Chedeau. "A Deep Dive into React Native". https://www.youtube.com/watch?v=7rDsRXj9-cU. 
  19. "React Native: Bringing modern web techniques to mobile". 26 March 2015. https://code.facebook.com/posts/1014532261909640/react-native-bringing-modern-web-techniques-to-mobile/. 
  20. "Bridging in React Native". 14 October 2015. https://tadeuzagallo.com/blog/react-native-bridge/. 
  21. "How we build React Native app: 7 things which save your development time. Part 2". https://blog.uptech.team/how-we-build-apps-on-react-native-part-2-7-things-you-should-know-to-save-your-development-time-944533f81c03. 
  22. "Using TypeScript". Meta Platforms, Inc.. https://reactnative.dev/docs/typescript. 
  23. "React Native Style". https://reactnative.dev/docs/style. 

References