mirror of
https://github.com/facebook/react.git
synced 2026-02-24 12:43:00 +00:00
40 lines
1.2 KiB
HTML
40 lines
1.2 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<title>Basic Example with Precompiled JSX</title>
|
|
<link rel="stylesheet" href="../shared/css/base.css" />
|
|
</head>
|
|
<body>
|
|
<h1>Basic Example with Precompiled JSX</h1>
|
|
<div id="container">
|
|
<p>
|
|
If you can see this, React is not running. Try running:
|
|
</p>
|
|
<pre>npm install -g babel
|
|
cd examples/basic-jsx-precompile/
|
|
babel example.js --out-dir=build</pre>
|
|
</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>
|
|
<pre>npm install -g babel
|
|
cd examples/basic-jsx-precompile/
|
|
babel example.js --out-dir=build</pre>
|
|
|
|
<p><i>With Babel 6.0 or higher</i></p>
|
|
<pre>npm install -g babel-cli
|
|
npm install babel-preset-react
|
|
cd examples/basic-jsx-precompile/
|
|
babel example.js --presets react --out-dir=build</pre>
|
|
<p>
|
|
Learn more about React at
|
|
<a href="https://facebook.github.io/react" target="_blank">facebook.github.io/react</a>.
|
|
</p>
|
|
<script src="../../build/react.js"></script>
|
|
<script src="../../build/react-dom.js"></script>
|
|
<script src="build/example.js"></script>
|
|
</body>
|
|
</html>
|