3 ms·
Setting up a build system is not required, React with JSX can be inlined using plain old <script> tags just fine I believe. <head> <script src="https://c
by dave7 8y ago
Setting up a build system is not required, React with JSX can be inlined using plain old <script> tags just fine I believe.
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.6/react.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/0.14.6/react-dom.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-core/5.8.23/browser.js"></script>
</head>
<body>
<div id="app"></div>
<script type="text/babel">
// React with JSX goes here
</script>
</body>
It it is less performant than compiled setup, of course.
- acemarke 8y agoThe React docs point to a much more recent example of this setup: https://raw.githubusercontent.com/reactjs/reactjs.org/master/static/html/single-file-example.html https://raw.githubusercontent.com/reactjs/reactjs.org/master... And have actual instructions here: https://reactjs.org/docs/add-react-to-a-website.html https://reactjs.org/docs/add-react-to-a-website.html