组件 & Props
Component And Props
函数组件与class组件
## 渲染组件
* 组件名称必须以大写字母开头
* 当 React 元素为用户自定义的组件时,它会将 JSX 所接收的属性 attributes 以及子组件 children 转换为单个对象传递给组件,这个对象被称为 props
```jsx harmony
function Welcome(props) {
return <h1>Hello, {props.name}</h1>
}
const element = <Welcome name="Sara" />
ReactDOM.render(
element,
document.getElementById('root')
)组件组合
提取组件
Props 的只读性
最后更新于