-
-
Save codebucks27/4ba593d311b72b9e83243c7461fa7c86 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from "react"; | |
const HOC = (Component, data) => { | |
//console.log("data", data); | |
return class extends React.Component { | |
constructor(props) { | |
super(props); | |
this.state = { | |
count: data, | |
}; | |
} | |
handleClick = () => { | |
this.setState({ | |
count: this.state.count + 1, | |
}); | |
}; | |
render() { | |
return ( | |
<Component | |
CountNumber={this.state.count} | |
handleCLick={this.handleClick} | |
/> | |
); | |
} | |
}; | |
}; | |
export default HOC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment