Created
October 31, 2018 13:57
-
-
Save stephen-james/19be16bb1cf39accecb1e5801167839f to your computer and use it in GitHub Desktop.
Unwrapping Mobx Injected components
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
const unWrapMobxInjectedComponent = <T extends {}>(component: IWrappedComponent<T>): T => { | |
let last: any = component; | |
while (component.wrappedComponent) { | |
last = component.wrappedComponent; | |
} | |
return last as T; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment