首页 > 其他 > 详细

Functional and Class Components

时间:2017-03-21 13:05:46      阅读:225      评论:0      收藏:0      [点我收藏+]

Functional and Class Components

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

  技术分享

  This function is a valid React component because it accepts a single "props" object argument with data and returns a React element. We call such components "functional" because they are literally JavaScript functions.

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

  技术分享

  

  The above two components are equivalent from React‘s point of view.

 

参考:https://facebook.github.io/react/docs/components-and-props.html#functional-and-class-components

Functional and Class Components

原文:http://www.cnblogs.com/tekkaman/p/6593528.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!