import React from 'react'
import Son from './son'
class Father extends React.Component {constructor(props) {super(props)}state = {info: '父组件',}handleChange = (e) => {this.setState({info: e.target.value,})}render() {return (<div><input type='text' value={this.state.info} onChange={this.handleChange} /><Son info={this.state.info} /></div>)}
}
export default Father// 子组件
import React from 'react'
interface IProps {info?: string
}
class Son extends React.Component<IProps> {constructor(props) {super(props)}render() {return (<div><p>{this.props.info}</p></div>)}
}
export default Son