Kim Stacks
Kim Stacks

Reputation: 10812

How to get started with ReactJS Hello World example?

I am using MacBook Pro.

I prefer to use ubuntu in a VM for web development.

I created a index.html inside my Macbook and then simply open it with Chrome.

The html was created following this video

and this is my code

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name=description content="">
    <meta name=viewport content="width=device-width, initial-scale=1">
    <title>First Component</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.0-beta.1/react.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.0-beta.1/JSXTransformer.js"></script>
</head>
<body>
    <script type="text/jsx">
    /** @jsx React.DOM */
    var APP = React.createClass({
        render: function() {
            return (
                <h1>Hello World</h1>
            );
        }
    });

    React.renderComponent(<APP />, document.body);
    </script>
</body>
</html>

I got the following error:

enter image description here

When I expand on the error:

enter image description here

Please advise.

Upvotes: 2

Views: 3287

Answers (1)

Dhiraj
Dhiraj

Reputation: 33618

Update:

In the newer versions it is (documentation)

ReactDOM.render(reactElement, domContainerNode)

It is should be React.render and not React.renderComponent as per documentation

The video you mentioned uses 0.8 and you are using 0.13.

From 0.12 renderComponent has been replaced with render

Upvotes: 6

Related Questions