J
J
John Gault2015-11-27 02:17:17
JavaScript
John Gault, 2015-11-27 02:17:17

Getting started with Reatc.js?

Please help me figure it out. To get started, I use the following template:

<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8" />
    <title>thenewboston</title>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/react.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.13.3/JSXTransformer.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="scripts.js"></script>
</head>
<body>

    <div id="content"></div>

    <script type="text/jsx">

    var BuckysComponent = React.createClass({
        render: function() {
            return (
                    <h2>My name is Bucky</h2>
            );
        }
    });

    React.render(<BuckysComponent />, document.getElementById('content'));

    </script>

</body>
</html>

And in general, everything works for me, but what if I want to put the JSX code into a separate file, to which I will then give a link in my html file? What extension should he ask or what else is needed? Indeed, in this case type="text/jsx" is used

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Androguide, 2015-11-27
@Fargal_1

Just like normal js.
Here is an initial lesson on this topic in Russian.
www.youtube.com/watch?v=G7Ju9CFYCko

M
Maxim, 2016-03-12
@maxfarseer

Good afternoon, ready for a course on react for beginners. I will be glad if it helps you.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question