React Core Features
React Core Features
Here is a summary of the core features. We will cover each feature in detail throughout the examples.
JSX (JavaScript Syntax Extension)
- JSX has a concise and familiar syntax for defining tree structures with attributes
- JSX syntax needs to be transpiled to JavaScript (i.e. by Babel)
- In contrast to JavaScript, JSX is statically-typed
- JSX uses ES6 classes, which are similar to Java
One-way data flow
- Properties are passed by the parent component to the child components
- The properties are treated as immutable values
- Child components should never directly modify any properties that are passed to them
- PropTypes can be used for defining the type of each property that is passed to a given component. If a component receives an invalid value for a property, there will be a warning in the console. PropTypes are checked during runtime
Virtual DOM
- React uses the Virtual DOM to create an in-memory copy of the browsers DOM
- When changing the state of components, React updates the virtual DOM first
- After that it computes the resulting differences, and updates the browser’s displayed DOM efficiently

Lifecycle methods
These methods can be overridden for each component, to run code during a specific lifecycle phase.
- Mounting:
constructor()componentWillMount()render()componentDidMount()
- Updating:
componentWillReceiveProps()shouldComponentUpdate()componentWillUpdate()render()componentDidUpdate()
- Unmounting:
componentWillUnmount()
- Error handling (since React 16 – released September 2017):
componentDidCatch()
We will explain these core features in more detail with a couple of code snippets in the next section.
Babel (ES5, ES6)
The JavaScript syntax that you will see in our examples is ECMAScript 6 (ES6) notation. If you need to run your web app inside older web browsers, you can use Babel (https://babeljs.io/) to transpile ES6 code to ES5. Here is an example how babel will transpile the ES6 arrow function to a regular ES5 function.
| ES6 syntax | Transpiled to ES5 syntax |
[1,2,3,4].map(n => n + 1); |
[1,2,3,4].map( |
https://blog.codecentric.de/en/2017/11/developing-modern-offline-apps-reactjs-redux-electron-part-2-reactjs-basics/
React Core Features的更多相关文章
- 解决CocoaPods could not find compatible versions for pod "React/Core"
react-native框架中,在ios文件夹下执行pod install命令时出现的问题. 下面时完整的异常信息: [!] CocoaPods could not find compatible v ...
- react new features 2020
react new features 2020 https://insights.stackoverflow.com/survey/2019#technology-_-web-frameworks h ...
- React Native pod install报错 `Yoga (= 0.44.3.React)` required by `React/Core (0.44.3)`
使用pod安装,可能会因为Podfile的路径指向错误或者没有路径指向因为报错. 报错截图如下: 这是因为在指定的路径没有寻找到相应的组件.此时就需要修改podfile文件中的路径,由于上方提示没有 ...
- SpringBoot(四) Core Features: Logging
参考 文档: 26. Logging
- SpringBoot(二) Core Features: SpringApplication
参考 文档: SpringApplication
- SpringBoot(三) Core Features: External Configuration(配置文件)
码云: external-configuration 可以使用属性文件,YAML文件,环境变量和命令行参数来外部化配置 一.属性值可以直接注入到bean 系统属性值不可以 // application ...
- react programming
So you're curious in learning this new thing called Reactive Programming, particularly its variant c ...
- .NET Core 和 .NET Framework 之间的关系
引用一段描述:Understanding the relationship between .NET Core and the .NET Framework. .NET Core and the .N ...
- Professional C# 6 and .NET Core 1.0 - 40 ASP.NET Core
本文内容为转载,重新排版以供学习研究.如有侵权,请联系作者删除. 转载请注明本文出处:Professional C# 6 and .NET Core 1.0 - 40 ASP.NET Core --- ...
随机推荐
- Windows忘记BIOS密码/操作系统密码处理办法汇总
一.说明 关于电脑,在大学之前是知之甚少的.举几个例子,一是刚上大学时我还是分不清主机和显示器哪个才是电脑:二是应该是大一上学期陪窒友Z到电科买电脑,我问导购员XP和Win7什么关系----我一直怀疑 ...
- 【chromium】 cef源码下载
至少需要17GB的磁盘空间,不光有CEF源码,还会下载chromium源码.编译master分支的话,如果编译到chromium可能会需要windows sdk,windows sdk的版本可以参考下 ...
- 关于 Windows to go
1. 在宿主计算器的操作系统中访问 Windows to go 的磁盘 如题,如果需要在宿主计算器的操作系统中访问 Windows to go 的U盘(移动硬盘)中的文件,只需要打开磁盘管理,“更改驱 ...
- 定时删除10天前的Es索引
说明 主要用在索引名为 xxxx-yyyy.MM.dd 这种,可以自定义修改下边的脚本 删除索引shell 创建 delete_es_indices_over_10_day.sh #!/bin/bas ...
- HDU校赛 | 2019 Multi-University Training Contest 2
2019 Multi-University Training Contest 2 http://acm.hdu.edu.cn/contests/contest_show.php?cid=849 100 ...
- phpstorm 2016.3.2 的最新破解方法
v2.0 最新的方式 第一:下载PHPStorm20173.2:(下载链接:windows) 第二:直接用浏览器打开 http://idea.lanyus.com/ ,点击页面中的“获得注册码”,然后 ...
- IdentityServer4学习及简单使用
本文,主要用来记录IdentityServer4的简单使用. 一. IdentityServer的预备知识 要学习IdentityServer,需要了解下基于Token的验证体系,其中涉及到Token ...
- Python网络编程、爬虫之requests模块使用
一.python操作网络,也就是打开一个网站,或者请求一个http接口,使用urllib模块. urllib模块是一个标准模块,直接import urllib即可,在python3里面只有urllib ...
- Vue – 基础学习(2):组件间 通信及参数传递
Vue – 基础学习(2):组件间 通信及参数传递
- Springboot jpa多数据源
1.SpringBootApplication package com.xx.xxx; import org.springframework.beans.factory.annotation.Auto ...