Kick Start React
Introduction to React JS
Necessary things
- Visual Studio Code
- Install Node.JS (LTS/Stable) version.
Node Installation For Linux
- Update your system
apt-get update
- Download Curl
sudo apt install curl
- Install Node with bash
curl -fsSL https://deb.nodesource.com/setup_14.x | sudo -E bash -
sudo apt-get install -y nodejs
- Your Node is successfully installed check your version now
node --version
Create your First React Application
We are going to create a CRM.
- Login
- Customer Request Page
- Home Page
- Services
- About
npx create-react-app crm
Run your First Project
npm start
Directory Structure
- Node Modules a. All of the installed packages are available here
- public a. Index.html 1. Main File 2. All files we need to make public
- src a. React Application b. We do all of the work in source [components/store]
- package-lock.json a. Tree of all of the dependencies, e.g our 1 library is dependent on some other library in this file we have all of the tree structure.
- package.json a. All of the libraries with versions we installed in our system.
Why React?
React.js is an open-source JavaScript library that is used for building user interfaces specifically for single-page applications. It’s used for handling the view layer for web and mobile apps. React also allows us to create reusable UI components. React was first created by Jordan Walke, a software engineer working for Facebook. React was first deployed on Facebook’s newsfeed in 2011 and on Instagram.com in 2012.
React allows developers to create large web applications that can change data, without reloading the page. The main purpose of React is to be fast, scalable, and simple. It works only on user interfaces in the application. This corresponds to the view in the MVC template. It can be used with a combination of other JavaScript libraries or frameworks, such as Angular JS in MVC.
React.js properties include the following
- React.js is declarative
- React.js is simple
- React.js is component-based
- React.js supports server-side
- React.js is extensive
- React.js is fast
- React.js is easy to learn Learn More here
The flow of React Application
- Main file = src/index.js
const root = ReactDOM.createRoot(document.getElementById('root'));
- Index.js File to load application We render all of our components in this part of the code.
root.render(
<React.StrictMode>
<App />
</React.StrictMode>
);
src/App.js file to write our Application logic
function App() {
return (
<div className="App">
</div>
);
}
GitHub Link: https://github.com/SohaibAnwaar/ReactTraining
Contact Link: www.sohaibanwaar.com