What is React.js
Source: Dev.to
What is React.js
React helps developers create:
- Websites
- Single Page Applications (SPA)
- Dashboards
- E-commerce apps
- Social media apps
- Mobile apps (with React Native)
Why React was Created
React was created to solve problems developers faced while building larger and dynamic web applications.
Before React, developers updated HTML manually using JavaScript.
document.getElementById("title").innerHTML = "welcome";
When the application became larger:
- Code became messy
- Updating UI became difficult
- Performance issues happened
React solves this by introducing:
- Components
- Virtual DOM
- State management
- Reusable UI
Difference Between a Library and a Framework
The primary difference is Inversion of Control (IoC):
- Library: You are in charge; you call the library.
- Framework: The framework is in charge; it calls your code.
When to Use a Library
- Need flexibility
- Small project
- Specific feature only
- Want custom architecture
When to Use a Framework
- Building large applications
- Need a standard structure
- Team collaboration
- Faster large‑scale development
Simple Concept
- Library = Helper (it helps your code)
- Framework = Foundation (your app runs inside it)
What is a Build Tool
A build tool is a software utility that automates the process of converting source code—typically JSX, modern JavaScript (ES6+), and CSS—into an optimized, production‑ready format that web browsers can understand.
Why Build Tools Are Needed
Modern web applications use:
- Multiple files
- React components
- TypeScript
- SCSS
- Images
- APIs
- Modules
Browsers cannot directly understand everything. For example, browsers do not understand JSX directly. Build tools convert them into normal JavaScript, HTML, and CSS.
Common Examples by Language
- Java: Apache Maven, Gradle
- JavaScript: npm, webpack, Vite
- C/C++: Make, CMake
- Python: Poetry, pip
What is Vite
Vite (pronounced “veet”) is a modern frontend build tool used to create fast web applications. It offers instant server startup and lightning‑fast Hot Module Replacement (HMR), making it a popular replacement for tools like Create React App.
Why Vite Was Created
Older build tools like Webpack became slow for large applications, leading to:
- Slow startup
Vite was created to solve these speed problems.
What Vite Helps Developers Do
- Start projects quickly
- Run development servers
- Bundle files
- Optimize applications