react jsx - Typescript, JSX: render component, passed as argument -


i want write function, renders react component, passed argument function. want handle both component , statelesscomponent types. how that:

function rendercomponent(component: react.componentclass<any> | react.statelesscomponent<any>) {     return <component />; } 

i got compilation error:

error ts2604: jsx element type 'component' not have construct or call signatures. 

what doing wrong?

in example rendercomponent function getting instance of component , not class/ctor.
should be:

function rendercomponent(componentclass: { new (): react.componentclass<any> | react.statelesscomponent<any> }) {     return <componentclass />; } 

Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -