首页 > 代码库 > React

React

React

1、The smallest React example looks like this:

  技术分享

2、You can embed any JavaScript expression in JSX by wrapping it in curly braces.

  技术分享

3、After compilation, JSX expressions become regular JavaScript objects.

  This means that you can use JSX inside of if statements and for loops.

  技术分享

4、通过“”或{}指定属性

  技术分享

  技术分享

  Don‘t put quotes around curly braces when embedding a JavaScript expression in an attribute. Otherwise JSX will treat the attribute as a string literal rather than an expression. 

5、React Only Updates What‘s Necessary

6、The simplest way to define a component is to write a JavaScript function:

  技术分享

  You can also use an ES6 class to define a component:

  技术分享

7、Rendering a Component,Always start component names with a capital letter.

  技术分享

8、Typically, new React apps have a single App component at the very top.

  技术分享

9、Props are Read-Only

  

参考:

https://facebook.github.io/react/docs/introducing-jsx.html

React