React Study Notes

Source: Internet
Author: User

Four ways to represent conditional expressions:

1, ternary operator, "Hello World";

2, use a function, inside can use if Else statement, and then use a variable to get the return value, directly use the variable on the line;

Getname:function () {

if (



Return "Hello World"}

Const A = GetName ();//directly behind {a}

3, is to call this function directly; {this.getname ()}//note here that This.getname () means that the function returned is obtained, and this.getname represents the function called GetName;

4. Using the operator {| | Hello world}//says that if has a value, take, and if not, go to Hello World.

This is a simple all-purpose expression:

function (obj) {

if (


else return "World"

}) (this)//the following parenthesis means calling this function and passing in the parameter this

React diff algorithm

In the algorithm, if the nodes are different, end the comparison directly, discard the old nodes, and create a new node. The diff algorithm is performed each time it is rendered, and the old node is not deleted in the algorithm, but it is changed on the old node.

React Study Notes

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.