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

c# - Class in a list -

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

Jdbc Odbc Driver error -