import React, {Component} from 'react'; import PubSub from 'pubsub-js' class New extends Component { constructor(props) { super(props); this.state = { num: 5, ztext: 'yasaka' } } fun = () => { this.setState({num: this.state.num + 1}) } render() { return (
父组件传过来值为 ---- {this.props.text} -- {this.state.num}
); } } export default New;