React.js without ES6
Reactjs is the best frontend library ever created. It is made by Facebook to perform several tasks in the frontend itself. ES6 is the standardization of javascript for making code more readable and more accessible.
If we don’t use ES6 in react, there is an alternative to perform. We use create-react-class instead of ES6. Let’s see some variations between ES6 and the create-react-class method.
For a detailed article for ES6, please refer: Introduction to ES6
Creating React Application And Installing Module:
- Step 1: Create a React application using the following command.
npx create-react-app foldername
- Step 2: After creating your project folder i.e. foldername, move to it using the following command.
cd foldername
- Step 3: After creating the ReactJS application, Install the create-react-class modules using the following command.
npm install create-react-class
Project Structure:
1. Use of Create-react-class: It is used as an alternative to default class-based component.
ES6 implementation:
import React from 'react'
import "./App.css"
// Make a App class component using ES6
class App extends React.Component {
render() {
return <h1>Hello Welcome to, GeeksforGeeks</h1>;
}
}
export default App;
Please Login to comment...