no message
This commit is contained in:
@@ -1,42 +0,0 @@
|
||||
/*
|
||||
* @Author: chenxuan
|
||||
* @Date: 2021-11-22 12:52:57
|
||||
* @LastEditTime: 2022-01-19 15:38:43
|
||||
* @LastEditors: chenxuan
|
||||
*/
|
||||
import React from "react";
|
||||
import extendsHoc from './components/hoc/extends'
|
||||
function NoStatusComponents(props) {
|
||||
return (
|
||||
<div>
|
||||
{props.title}
|
||||
<button type="button" onClick={props.sendParent.bind(this, "xxxx")}>
|
||||
给父组件传值
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
class App extends React.Component {
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {
|
||||
age: 30,
|
||||
};
|
||||
}
|
||||
getValue(val) {
|
||||
console.log(val);
|
||||
}
|
||||
render() {
|
||||
return (
|
||||
<div>
|
||||
<NoStatusComponents
|
||||
title="我是无状态子组件"
|
||||
sendParent={this.getValue.bind(this)}
|
||||
></NoStatusComponents>
|
||||
<li>{this.props.title}</li>
|
||||
<li>{this.props.name}</li>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
export default extendsHoc(App,"高阶函数反向继承!");
|
||||
Reference in New Issue
Block a user