首页 > 代码库 > Functional and Class Components
Functional and Class Components
【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
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。