Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6211

React Native High Order Component for State Component

$
0
0

I'm trying to do a hoc for a state component in React Native with Typescript which is defined below:

export function hoc<T extends ComponentClass>(target: any): T {
  return (target: any) =>
    class MyClass extends Component<any, any> {

    }
}

But I get the error Type '(target: any) => typeof MyClass' is not assignable to type 'T'

What should I change to make it correct with typescript?


Viewing all articles
Browse latest Browse all 6211

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>