This commit is contained in:
2022-01-17 00:28:49 +08:00
parent cc6c0df2ab
commit 8a4c8cb1e6
4 changed files with 59 additions and 4 deletions
+8 -1
View File
@@ -1,6 +1,13 @@
/*
* @Author: chenxuan
* @Date: 2021-11-21 15:55:16
* @LastEditTime: 2022-01-15 00:21:58
* @LastEditors: chenxuan
*/
import React from 'react'
import proxyHoc from './components/proxyHoc'
const Chenxuan=proxyHoc((props)=>{
console.log(props)
return(
<div>
<h1>{props.title}</h1>
@@ -17,7 +24,7 @@ class App extends React.Component{
render(){
return(
<div>
<Chenxuan title="xxxxx" id="66666"></Chenxuan>
<Chenxuan title="xxxxx1" id="66666" hehe="xxxx"></Chenxuan>
</div>
)
}
@@ -1,10 +1,16 @@
/*
* @Author: chenxuan
* @Date: 2021-11-21 15:55:16
* @LastEditTime: 2022-01-15 00:19:25
* @LastEditors: chenxuan
*/
import React from 'react'
function Hehe(WithComponent){
return class HocComponent extends React.Component{
constructor(){
super();
this.state={
userName:""
userName:"666"
}
}
setUsername(e){
@@ -17,9 +23,8 @@ function Hehe(WithComponent){
value:this.state.userName
}
};
console.log(this.props)
return(
<React.Fragment>
<li>{this.state.userName}</li>
<WithComponent