score:9

Accepted answer

This is apparently an issue which was introduced in the 15.0.5 React type definitions. If you change to 15.0.4, everything should be fine.

See this issue: https://github.com/DefinitelyTyped/DefinitelyTyped/pull/14284

score:41

If you have JSX inside your component or component test file must have .tsx as your file extension. My code was not compiling as I had the .ts file extension. The moment I renamed it to .tsx/jsx it started working nicely!

Please also note that I was using Typescript, so that's why I renamed it to .tsx. In case you are using ES6 rename it to .jsx.


Related Query

More Query from same tag