I'm trying to get some basic jsx to display some text in a regular web browser. By double clicking the main html file and having the code open in chrome, firefox .....
I've followed along with a few intro tutorials on those links and a few books.
This one is the only one that seemed to touch on opening the program in an actual web browser. The problem is that it didn't include some of the extra stuff like creating classes and stuff that the other ones did.
I can't seem to find the reason that my code isn't printing anything
Desired Output
Hello world
printed in the web browser I'm using (Firefox)
jsx/index.js
import React from 'react';
import { render } from 'react-dom';
class navBar extends React.Component {
render() {
return <div>Hello world</div>;
}
}
render(<navBar />, document.body)
index.html
<!DOCTYPE html>
<html>
<head>
<title>Hello World</title>
<script src="https://unpkg.com/react@0.14.7/dist/react.js"></script>
<script src="https://unpkg.com/react-dom@0.14.7/dist/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.2/browser.min.js"></script>
<meta charset="utf-8" name="viewport" content="user-scalable=no, width=device-width" />
</head>
<body>
<script type='text/babel' src='jsx/index.js'></script>
</body>
</html>
Aucun commentaire:
Enregistrer un commentaire