父子组件 (父–>子)
在父组件中:
import React from 'react'
import ChildCom from './childCom.js'
class ParentCom extends React.Component {
render() {
return (
<div>
<h1>父组件</h1>
<ChildCom content={
'我是父级过来的内容'}/>
</div>
)
}
}
export default ParentCom;
在子组件中
import React from 'react'
class ChildCom extends React.Component {
render() {
return (
<div