I\'m getting a ts error from my react component. The component is running fine, building etc, however typescript is showing an error inside the ide. Not sure how i need to d
Had the same issue, but my problem was that I was importing React wrong.
The correct way to import it when using TypeScript is with import * as React from "react".
Code example:
import * as React from "react"
import ReactDOM from "react-dom"
class App extends React.Component {
render() {
return (
Hello, World!
)
}
}
ReactDOM.render( , document.getElementById("app"))
Note: allows you to use any props and state variables in your React component, but you should usually define those yourself to take advantage of TypeScript's type annotations.