Assuming I am using the right pattern, I would like to be able to call someFunc()
- which is inside <Home/>
- from inside <Wrapper/>
. See below:
var Home = React.createClass({
someFunc() {
console.log('How can I call this from <Wrapper/>?')
},
render() {
return <h1>Hello World</h1>
}
})
var Wrapper = (Home) => {
return React.createClass({
render() {
return <Home {...this.props}/>
}
})
}
var HomeWrapped = Wrapper(Home)
ReactDOM.render(<HomeWrapped/>, document.getElementById('root'))
updated with solution: https://codepen.io/oldgithub/pen/qPOZEj
You can use
ref
for that: