ReactJS | Using Babel Last Updated : 30 Mar, 2021 Summarize Comments Improve Suggest changes Share Like Article Like Report Now we know that what Babel is, we will focus on how to install it on your machine using node. Babel can be installed easily after following these simple steps. Requirements : A code editor like atom, sublime text or Visual studio code.Node should be installed on the machine with npm too. We will install Babel using Node. Open your text editor, then create your directories structure like the one below: |--node_modules |--src --app.js |--.babelrc |--package.json |--package.lock.json If you know how node works then you know about node_modules, package.json, and package.lock.json. These are automatically formed once we run some commands. Now, open the command line and set the path to the directory of the folder then write these lines in the cmd: npm install --save-dev @babel/core @babel/cli @babel/preset-env @babel/node npm install nodemon --save-dev The first npm commands will install babel dependencies and the second will is used to install nodemon which allows us to update the browser content without refreshing it. After entering the command we will get: As we can see in the above image, the command that we used to install babel dependencies are now visible in our 'package.json' file. It is also important to add the below line inside the .babelrc file which we have in our project directory. // .babelrc { "presets": ["@babel/preset-env"] } Now we finally need to add scripts into our 'package.json' file. "start": "nodemon --exec babel-node src/app.js" // inside your scripts tag The final 'package.json' will look like this: Now we are all set we just need to write normal ES6, 7, 8 code in our app.js file and run it with 'npx babel filename' command where 'filename' is replaced by app.js here, and we will get the ES5 output in the console. Example: javascript // next generation javascript code let alice = () => {}; let bob = (b) => b; const usingMap = [1, 2, 3].map((number) => number * 2); console.log(usingMap); // [2, 4, 6] var immukul = { _name: "Mukul", _friends: ["Mukul", "Mayank"], printFriends(){ this._friends.forEach( f =>console.log(this._name + " knows " + f)); } }; console.log(immukul.printFriends()); Output: Comment More infoAdvertise with us I immukul Follow Improve Article Tags : ReactJS Similar Reads React Interview Questions and Answers React is an efficient, flexible, and open-source JavaScript library that allows developers to create simple, fast, and scalable web applications. Jordan Walke, a software engineer who was working for Facebook, created React. Developers with a JavaScript background can easily develop web applications 15+ min read React Tutorial React is a powerful JavaScript library for building fast, scalable front-end applications. Created by Facebook, it's known for its component-based structure, single-page applications (SPAs), and virtual DOM,enabling efficient UI updates and a seamless user experience.Note: The latest stable version 7 min read 90+ React Projects with Source Code [2025] React, managed by Facebook and a vibrant community of developers and companies, is a JavaScript library designed to craft dynamic user interfaces. It empowers developers with concepts like React web apps, components, props, states, and component lifecycles. With a primary focus on building single-pa 12 min read Frontend Developer Interview Questions and Answers Frontend development is an important part of web applications, and it is used to build dynamic and user-friendly web applications with an interactive user interface (UI). Many companies are hiring skilled Frontend developers with expertise in HTML, CSS, JavaScript, and modern frameworks and librarie 15+ min read React Introduction ReactJS is a component-based JavaScript library used to build dynamic and interactive user interfaces. It simplifies the creation of single-page applications (SPAs) with a focus on performance and maintainability.It is developed and maintained by Facebook.The latest version of React is React 19.Uses 8 min read React Hooks ReactJS Hooks are one of the most powerful features of React, introduced in version 16.8. They allow developers to use state and other React features without writing a class component. Hooks simplify the code, make it more readable, and offer a more functional approach to React development. With hoo 10 min read React JSX JSX stands for JavaScript XML, and it is a special syntax used in React to simplify building user interfaces. JSX allows you to write HTML-like code directly inside JavaScript, enabling you to create UI components more efficiently. Although JSX looks like regular HTML, itâs actually a syntax extensi 6 min read React Router React Router is a library for handling routing and navigation in React JS Applications. It allows you to create dynamic routes, providing a seamless user experience by mapping various URLs to components. It enables navigation in a single-page application (SPA) without refreshing the entire page.This 6 min read ReactJS Virtual DOM ReactJS Virtual DOM is an in-memory representation of the actual DOM (Document Object Model). React uses this lightweight JavaScript object to track changes in the application state and efficiently update the actual DOM only where necessary.What is the Virtual DOM?The Virtual DOM (VDOM) is a lightwe 4 min read How to Install ReactJS on Windows: Step-by-Step Guide ReactJS has become one of the most popular JavaScript libraries for building dynamic and interactive user interfaces, powering some of the biggest websites and applications across the web. If you're a Windows user eager to dive into React development, setting up your environment properly is the firs 8 min read Like