Last active
August 26, 2018 05:25
-
-
Save datvtwkm/eb062ffe4fe41e0165f9f6b5a1b6bba8 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
// @flow | |
import React, { Component } from 'react'; | |
import type { ComponentType } from 'react'; | |
export default WrappedComponent=> ( | |
class EnhancedComponent extends Component<any> { | |
wrappedInstance: ?ComponentType<any> = null; | |
setWrappedInstance = (c: any) => { this.wrappedInstance = c; }; | |
render(){ | |
return (<WrappedComponent ref={this.setWrappedInstance} {...this.props}/>) | |
} | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment