react/examples/basic-jsx-precompile/index.html

41 lines
1.3 KiB
HTML
Raw Normal View History

2013-05-30 03:46:11 +08:00
<!DOCTYPE html>
<html>
<head>
2015-07-12 09:54:54 +08:00
<meta charset="utf-8">
<title>Basic Example with Precompiled JSX</title>
2013-05-30 03:46:11 +08:00
<link rel="stylesheet" href="../shared/css/base.css" />
</head>
<body>
<h1>Basic Example with Precompiled JSX</h1>
2013-05-30 03:46:11 +08:00
<div id="container">
<p>
If you can see this, React is not running. Try running:
2013-05-30 03:46:11 +08:00
</p>
<pre>npm install -g babel-cli
cd examples/basic-jsx-precompile/
npm install babel-preset-react
babel example.js --presets react --out-dir=build</pre>
2013-05-30 03:46:11 +08:00
</div>
<h4>Example Details</h4>
<p>This is written with JSX in a separate file and precompiled to vanilla JS by running:</p>
<p><i>With Babel lower than 6.0</i></p>
2015-09-19 08:04:43 +08:00
<pre>npm install -g babel
cd examples/basic-jsx-precompile/
2015-09-19 08:04:43 +08:00
babel example.js --out-dir=build</pre>
<p><i>With Babel 6.0 or higher</i></p>
<pre>npm install -g babel-cli
cd examples/basic-jsx-precompile/
npm install babel-preset-react
babel example.js --presets react --out-dir=build</pre>
2013-05-30 03:46:11 +08:00
<p>
Learn more about React at
<a href="https://facebook.github.io/react" target="_blank">facebook.github.io/react</a>.
2013-05-30 03:46:11 +08:00
</p>
<script src="../../build/react.js"></script>
<script src="../../build/react-dom.js"></script>
2013-05-30 03:46:11 +08:00
<script src="build/example.js"></script>
</body>
</html>