When compiling script
/// <reference path="./typings/react/react.d.ts" />
import React = __React;
var content = <div>Hello, world!</div>;
React.render(content, document.getElementById('output'));
I get an error
$ tsc --jsx react app.tsx
app.tsx(6,7): error TS2339: Property 'render' does not exist on type 'typeof __React'.
Is there any way to fix it? Thanks
import React = __React;
Please use import React = require('react')
... but this is not the source of your error
React.render(content, document.getElementById('output'));
Please use ReactDOM.render(
instead of React.render
. Get react-dom as import ReactDOM = require('react-dom')
. This is needed with react 0.14
.
Alternatively get the old definitions for React.
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