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?
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.
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? JSX stands for JavaScript XML. JSX allows us to write HTML in React. JSX makes it easier to write and add HTML in React.
Element vs ReactElement. Both types are the result of React. createElement() / jsx() function call.
This hacky typecast makes the error go away, though I don't understand it at all:
const App: any = require('./components/views/app/app');
How about:
class App extends React.Component<any, any> {
render() {
return <div>foo</div>;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With