一、父?jìng)髯?/p>
1.將子組件引入父組件中 并在需要的位置嵌入
例如
import User from '../user';
jsx: <User />
2. 在嵌入的組件上綁定自定義屬性
例如:
<User yh="1512A" msg="今天真熱啊" />
- 子組件如何接收 (this.props)
例如:
<div>
用戶組件內(nèi)容---{ this.props.yh }---{this.props.msg}
</div>