🌐
Toolsnip
toolsnip.com β€Ί tools β€Ί jsx-to-javascript
Free JSX to JavaScript Converter - Convert JSX to JS Online | ToolSnip | ToolSnip
Convert JSX syntax to plain JavaScript instantly. Transform React JSX components to vanilla JavaScript. Free online JSX to JavaScript converter.
Discussions

reactjs - How to convert react JSX files to simple JavaScript file [offline transformation] - Stack Overflow
If you are using babel-cli you ... to js syntax that the browser understands. See the following link: http://babeljs.io/docs/plugins/transform-react-jsx/ You'll need to install babel-plugin-transform-react-jsx plugin and use it in a .babelrc file like that: ... Then your babel command should work. ... Sign up to request ... More on stackoverflow.com
🌐 stackoverflow.com
JSX to ES6 converter(online preferably)
"yarn build" will create a bundle with a js file you can use. You can't just copy react code and expect it to run since there is a lot happening in the backend to handle states and other react features. More on reddit.com
🌐 r/react
4
0
August 18, 2022
reactjs - React.js - convert .jsx to .js - Stack Overflow
I'm totally new to React...how do I convert a .jsx file to .js? I tried to use Babel via CLI but the command doesn't even work: babel --plugins transform-react-jsx board.jsx I also tried replacing " More on stackoverflow.com
🌐 stackoverflow.com
August 4, 2018
node.js - Transform JSX to JS using babel - Stack Overflow
I'm new to babel and I'm trying to convert my main.jsx file to main.js. I installed the following babel plugin. npm install --save-dev babel-plugin-transform-react-jsx Created a file called .babel... More on stackoverflow.com
🌐 stackoverflow.com
🌐
GitHub
github.com β€Ί ganes1410 β€Ί JSX-to-Javascript
GitHub - ganes1410/JSX-to-Javascript: An online transpiler to convert JSX to JS
An online transpiler to convert JSX to JS. Contribute to ganes1410/JSX-to-Javascript development by creating an account on GitHub.
Author Β  ganes1410
🌐
React
legacy.reactjs.org β€Ί jsx-compiler.html
JSX Compiler Service
This tool has been removed as JSXTransformer has been deprecated.
🌐
Transform
transform.tools
Transform
to JSX Β· to Pug Β· to Big Query Schema Β· to Flow Β· to Go Bson Β· to Go Struct Β· to GraphQL Β· to io-ts Β· to Java Β· to JSDoc Β· to JSON Schema Β· to Kotlin Β· to MobX-State-Tree Model Β· to Mongoose Schema Β· to MySQL Β· to React PropTypes Β· to Rust Serde Β·
🌐
Transform
transform.tools β€Ί html-to-jsx
HTML to JSX
An online playground to convert HTML to JSX
🌐
Convert.Guru
convert.guru β€Ί jsx-converter
.JSX Converter - Convert React & Adobe Scripts to JS, TS, TXT files
Convert or analyse your React component and Adobe ExtendScript .JSX files online for free to .JS, .TXT, .PDF, or anything else. The .JSX file extension has two distinct primary uses.
Find elsewhere
🌐
Backbencher
backbencher.dev β€Ί converting-jsx-to-javascript
Joby.blog
August 10, 2022 - Essays and notes on JavaScript, React, and the web.
🌐
Medium
medium.com β€Ί @noyoncse3101 β€Ί how-jsx-convert-into-js-96a5cd9818bb
How JSX is converted into JS?. What is JSX? | by Md Sajjad Hosen Noyon | Medium
January 13, 2025 - How JSX is converted into JS? What is JSX? JSX is extensible version of JavaScript which means JavaScript XML the syntactical suger for React developers to create react components easily. It looks …
🌐
Stack Overflow
stackoverflow.com β€Ί questions β€Ί 49714230 β€Ί react-js-convert-jsx-to-js
reactjs - React.js - convert .jsx to .js - Stack Overflow
August 4, 2018 - The error above is from npx. You haven't touched babel yet. ... No, I'm not.... ... I installed babel locally in my project, then I ran the command "babel --plugins transform-react-jsx board.js", but it doesn't work, it says it's not recognized as a command. Then people are saying I have to pass the path where babel is locally installed, and i tried "./node_modules/.bin/babel --plugins transform-react-jsx board.js", but still the same error message.
Top answer
1 of 4
16

if you are only using babel to transform jsx to js, this is what you need :

installation

  • install babel-cli as global (optional) sudo npm install -g babel-cli
  • install babel-preset-es2015 (optional. if your code using es6 standard) npm install babel-preset-es2015
  • install babel-preset-react (required)

configuration

in your root of project, add this file .babelrc and write this to it

{
  "presets": ["es2015", "react"]
}

or

{
  "presets": ["react"]
}

run

babel source_dir -d target_dir
2 of 4
4

As of 2023 if you are using babel to transform jsx to js, this is what you will need to do:

Install Packages

Install the following globally on your machine:

npm install -g @babel/cli
npm install -g @babel/core
npm install -g @babel/preset-react

or install the following as a project dependency (my personal preference):

npm install --save-dev @babel/cli
npm install --save-dev @babel/core
npm install --save-dev @babel/preset-react

Create Configuration File

Create a .babelrc config file at the root of your project with the following setting as a bare minimum:

{
    "presets": ["@babel/preset-react"]
}

You should review the babel docs if you have a more complicated use case and determine what additional settings you may need to add. You can find the settings for compiling jsx to js on the @babel/preset-react page.

Compile

You can compile any jsx file into js by running the following command in your terminal:

npx babel [jsx-file-here.jsx] -d [output-directory]

If your jsx file imports anything please keep the following in mind:

  1. This will not import any imported code. You will need to also compile any files that are imported. You can then use your code as a browser module: see next 2 points.
  2. JS imports are widely supported now (see also) but you will need to add type="module" to the script tag in your HTML.
  3. Remember you must include the file extension .js in your import statements still! No browser will intuptret import Foo from './bar' as import Foo from './bar.js.
  4. If you do not want to do the previous you can use something like rollup.js to bundle all the files into a single script.
🌐
CodeConvert AI
codeconvert.ai β€Ί home β€Ί convert from typescript β€Ί typescript to javascript converter
Free TypeScript to JavaScript Converter - AI Code Translation | CodeConvert AI
Instantly convert TypeScript to JavaScript code with AI. Free, fast, and accurate code translation. 60+ languages supported, no signup required.
Top answer
1 of 2
1

Without knowing the rest of your project setup, I can't tell how the current app.js file is getting created, but you're right: what you need is to transpile the code via Babel. This can be done two ways in development: on the dev server (recommended), or in the dev browser using standalone Babel.

On the Dev Server (Recommended)

React's recommended way to start with React is using a tool called Create React App. Since you said you're new to React, this will take care of Babel behind the scenes and give you a development server (so you don't need WAMP, only Node and NPM), and a build process to create the assets like app.js to deliver to the production server.

If you don't have time to immediately learn Babel and Webpack, I'd recommend using Create React App first.

In the Dev Browser

If you don't want to introduce a new tool, and you just want to transpile JSX with minimal configuration, you can do this in the browser via the instructions. This used to be demonstrated in the React.js tutorials until they switched to recommending Create React App. The instructions for installing "in the browser" require two things: adding babel.min.js to your <head>, and adding the type="text/babel" attribute to your .jsx file (working code example below). However, the documentation gives this advice:

Compiling in the browser has a fairly limited use case, so if you are working on a production site you should be precompiling your scripts server-side. See setup build systems for more information.

Your HTML and JavaScript should look as follows (I've omitted a lot of your code for brevity):

index.html

<!doctype html>
<head>
  <script src=src="https://unpkg.com/babel-standalone@6/babel.min.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.5.0/react.js"></script>
  <script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.5.0/react-dom.js"></script>  
</head>
<body>
  <h1>Browser in JSX Demo</h1>
  <div id="appRoot">If you're seeing this, it's not working.</div>
  <script type="text/babel" src="app.jsx"></script>
</body>
</html>

app.jsx

class App extends React.Component {
  render() {
    return <div>It works!</div>;
  }
}

const el = document.getElementById('appRoot');
ReactDOM.render(<App />, el);

Please note that the extensions used in the script src attribute and the JavaScript file must match. You can use .jsx or .js, but they must match. I don't know how your server is working its magic, but that's beyond the scope of the question, and is not expected behavior by default.

2 of 2
1

You can use Webpack to achieve what you want.

You can download every dependencies like this (if you have npm installed):
npm install --save-dev webpack
npm install --save-dev webpack-dev-server
npm install --save-dev loader-utils html-webpack-plugin extract-text-webpack-plugin
npm install --save-dev babel-core babel-loader babel-register
npm install --save-dev babel-preset-es2015 babel-preset-react

Then you can create the file webpack.config.js at the root of your folder with this code inside:

import path from 'path';  
import HtmlWebpackPlugin from 'html-webpack-plugin';

export default () => ({  
  entry: [
    path.join(__dirname, 'src/index.jsx'),
  ],
  output: {
    path: path.join(__dirname, 'dist'),
    filename: 'bundle.js',
  },
  plugins: [
    new HtmlWebpackPlugin({
        filename: 'index.html',
        template: './src/index.html'
    }),
  ]
  module: {
    rules: [
      {
        test: /.jsx?$/,
        exclude: /node_modules/,
        include: path.join(__dirname, 'src'),
        use: [
          {
            loader: 'babel',
            options: {
              babelrc: false,
              presets: [
                ['es2015', { modules: false }],
                'react',
              ],
            }
          }
        ]
      },
    ]
  },
});

And in your package.json, add those lines:

{
  ...
  "scripts": {
    "dev": "webpack-dev-server",
    "build": "webpack"
  }
  ...
}

You will now be able to run npm run dev for development and npm run build to compile the code ready for a production server.

You can init npm in your project if it's not already done like this npm init

You can also follow this guide: Setting Up A React Workflow with Babel and Webpack 2

Webpack is basically a tool that takes every .jsx file and convert it to a .js file. In the code above, I use index.jsx as the main file. Every react component that will be imported in this file will be automatically computed.