- React Router Quick Start Guide
- Sagar Ganatra
- 376字
- 2021-07-23 16:41:31
A brief look at React
React is a JavaScript library that provides a set of components and services and enables you to build user interfaces.
Here is a quote from reactjs.org:
"React is a declarative, efficient, and flexible JavaScript library for building user interfaces."
The library is developed and maintained by Facebook and is licensed under MIT. It's extensively used in building various applications at Facebook, including Facebook web and Instagram web.
React enables you to build view components that get updated when the application's state changes. The state here could refer to the underlying domain data, or it may reflect where the user is in the application journey. React ensures that the view components reflect the application state.
Here are some of the important features of React:
- JSX: Components in React applications use an XML/HTML-like syntax, known as JSX, to render the view elements. JSX allows you to include HTML in your JavaScript/React code; the familiar syntax of HTML with attributes in your React component's render function does not require you to learn a new templating language. This JSX is then used by preprocessors such as Babel to transpile HTML text to JavaScript objects that the JavaScript engine can understand.
- One-way data binding: React applications are organized as a series of nested components; a set of immutable values are passed to the component's renderer as properties in HTML tags. The component does not modify the properties (or props) it receives from its parent; instead, the child communicates the user actions to its parent component and the parent component modifies these properties by updating the component's state.
- Virtual DOM: In React, for every DOM object, a corresponding virtual DOM object is created that has the same set of properties as the real DOM object. However, the virtual DOM object lacks the power to update the view when the user interacts with the page. Components in React re-render the view elements whenever a change in state is detected, and this re-render updates the virtual DOM tree. React then compares this virtual DOM tree with the snapshot that was created before the update to determine the DOM objects that changed. Finally, React modifies the real DOM by updating only those DOM objects that changed.
推薦閱讀
- 數(shù)據(jù)結(jié)構(gòu)與算法JavaScript描述
- PHP+MySQL+Dreamweaver動態(tài)網(wǎng)站開發(fā)實例教程
- Python高效開發(fā)實戰(zhàn):Django、Tornado、Flask、Twisted(第3版)
- PLC編程與調(diào)試技術(shù)(松下系列)
- HDInsight Essentials(Second Edition)
- 自制編程語言
- Android項目實戰(zhàn):手機安全衛(wèi)士開發(fā)案例解析
- 詳解MATLAB圖形繪制技術(shù)
- Maker基地嘉年華:玩轉(zhuǎn)樂動魔盒學(xué)Scratch
- R語言:邁向大數(shù)據(jù)之路(加強版)
- Android Studio Cookbook
- Python Web自動化測試設(shè)計與實現(xiàn)
- ASP.NET Core and Angular 2
- Web前端開發(fā)實戰(zhàn)教程(HTML5+CSS3+JavaScript)(微課版)
- Learning Network Programming with Java