Posted in
4
8:41 am, October 11, 2021
using babel for react compiling in browser
this is currently just an idea, as i saw that codepen uses babel to run react i was wondering i can do the same thing here and then just write normal react script and have babel compile it.
so it may not work! :)
Installing babel standalone
it seems that you should use a build system to run react normally, but this is just for testing anyway. Installation.
ok that works, this is just babel working standalone, how to combine this with react?
HTML
<div id="output"></div>
Scripts
<!-- Load Babel -->
<!-- v6 <script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script> -->
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script>
Javascript
const getMessage = () => "Hello World";
document.getElementById('output').innerHTML = getMessage();
View Statistics
This Week
44
This Month
281
This Year
0
Add Comment
Other Items in react
Using props with Stateless Functional Components in React
How to Access Props Using this.props in React
How to Use PropTypes to Define Props in React
How to Override Default Props in React
How to use default props in React
How to Pass an Array as Props in React
How to Pass Props to a Stateless Functional Component in React
How to Write a React Component from Scratch
How to Render a React Class Component to the DOM
How to Compose React Components in React
How to Use React to Render Nested Components
How to Create a Component with Composition in React
How to Create a React Component using the ES6 class method
What is a Stateless Functional Component in React
How do Self-Closing JSX Tags Work?
How to Define a HTML Class in JSX in React
How to Render HTML Elements to the DOM with React
How to Add Comments in JSX
Create a Complex JSX Element
Create a Simple JSX Element
adding react with JSX using babel
adding react to a website in 3 steps
using babel for react compiling in browser
react hello world with time and date updating
react hello world with variable name
react basic hello world
Related Search Terms
Other Categories in Code
c testing apache apps asp bat bootstrap bootstrap templates core css css grid design elements fancybox fonts foundation framework gimp git html icons ideas images javascript jquery js linux mac nginx node php php functions php simple html dom pi400 python react sections site bugs site documentation sql sqlite sublime svg templates tools virtual box webdev windows wordpress