这样可以吗
来源:1-4 自由编程
unbreakable_全栈
2021-01-26 12:07:01
import React, { Component } from "react";
import Children from "./Children";
class Father extends Component {
constructor(props) {
super(props);
this.state = {
value: "hello world",
};
}
render() {
return <Children content={this.state.value} />;
}
}
export default Father;
----------------------------------------------
import React, { Component } from "react";
class Children extends Component {
render() {
const { content } = this.props;
return <div>{content}</div>;
}
}
export default Children;
1回答
同学你好,效果是对的,继续加油,祝学习愉快~
相似问题