Why React?
React is a JavaScript library for building user interfaces, the famous UI, and, as said, uses the JavaScript programming language to code the interface that you want.
You can use ReactJS to create UI’s for web applications or use React Native to create apps for iOS and Android systems. In both cases you can use the same code, only the build will be different.
So, why use React instead of other languages to create a website?
React uses NodeJs which is a runtime from JS to properly function. NodeJs allows programmers to install (via npm command) several packages for innumerous propouses, such as Bootstrap for React, express, axios, babel, dotenv, redux, gulp, angular and much others.
This helps the programming effeciency because all packages will be in node_modules, you only need to import the package in the file you want and declare the variables.
This way you can both manage Frontend and Backend with only JS code!
You don’t need backend? No problem! Static pages will be rendered as a HTML code.
You need an e-commerce? Perfect! React will handle this situation like a charm, fetching from the backend all your products and its details, user creation, login and payments.
The only disadvantage is that the developer has to know JavaScript to use correctly this library but is nothing like C or Java to learn. In a couple months you will be able to code in JS with no problems.
Just a parenthesis, recently I discovered that you can use styles in JS, specifically in ReactJS, without using a CSS document.
A package know as styled-components can be installed on your ReactJS app and you can declare a const and the HTML tag that you want to use and then style it, like this
const Title = styled.div`font-size: 20px;
font-weight: bold;
color: black;
width: 70%;`;
After that, you just declare it in your code and voilà you have a styled component as you want inside the JS file you are working.
import React from ‘react’import styled from ‘styled-components’
const Name = () => {return (<Title>Hello world!</Title>)}export default Name
This is why I use React to code my e-commerce project. It helped a lot to handle all the situations on an e-commerce app and boosted my productivity.