Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSX element type does not have any construct or call signatures

Tags:

I'm using this simple React element on the left as my root element on the page in the right.

How do I fix the error shown?

enter image description here

like image 838
Richard Avatar asked Jun 07 '16 09:06

Richard


People also ask

Does not have any construct or call signatures JSX element?

The error "JSX element type does not have any construct or call signatures" occurs when we try to pass an element or a react component as props to another component but type the prop incorrectly. To solve the error, use the React. ElementType type.

What is the type of JSX element?

JSX is an embeddable XML-like syntax. It is meant to be transformed into valid JavaScript, though the semantics of that transformation are implementation-specific.

What is JSX element []?

What is JSX? JSX stands for JavaScript XML. JSX allows us to write HTML in React. JSX makes it easier to write and add HTML in React.

Is JSX element A React node?

Element vs ReactElement. Both types are the result of React. createElement() / jsx() function call.


2 Answers

This hacky typecast makes the error go away, though I don't understand it at all:

const App: any = require('./components/views/app/app');

like image 133
Richard Avatar answered Dec 31 '22 07:12

Richard


How about:

class App extends React.Component<any, any> {
    render() {
        return <div>foo</div>;
    }
}
like image 23
vorillaz Avatar answered Dec 31 '22 08:12

vorillaz