react组件复用
文章目录
class Mybtn extends Component {
render() {
return (
<button>{this.props.title}</button>
);
}
}
class App extends Component {
constructor(props) {
super(props);
}
render() {
return (
<div>
<h2>hello,{this.props.name}</h2>
<Mybtn title='提交'></Mybtn>
<Mybtn title='删除'></Mybtn>
<Mybtn title='修改'></Mybtn>
<Mybtn title='添加'></Mybtn>
</div>
)
}
}
export default App;
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论