
What is React ?
React is a JavaScript library for building user interfaces — especially single-page applications (SPAs). It was developed by Facebook and is used to create fast, interactive, and reusable UI components for web and mobile apps.
React.JS History
- Latest version of React.JS is 19.0.0 (December 2024).
- Initial release to the Public (version 0.3.0) was in July 2013.
- React.JS was first used in 2011 for Facebook's Newsfeed feature.
- Facebook Software Engineer, Jordan Walke, created it.
Component-based:
React applications are built using reusable components, which are essentially independent and self-contained pieces of the user interface.
JavaScript library:
React is not a full-fledged framework, but rather a library that focuses on the view layer of an application.
Single-page applications (SPAs):
React is often used to create SPAs, where the entire application is loaded in a single page, and subsequent content updates are handled dynamically without requiring full page reloads.
Virtual DOM:
React utilizes a virtual DOM (Document Object Model) to optimize performance. It efficiently updates the actual DOM by only changing the parts that have been modified.
JSX:
React commonly uses JSX, a syntax extension that allows you to write HTML-like code within JavaScript, making it easier to define the structure and content of UI components.
How does React Work?
React creates a VIRTUAL DOM in memory. Instead of manipulating the browser's DOM directly, React creates a virtual DOM in memory, where it does all the necessary manipulating, before making the changes in the browser DOM. React only changes what needs to be changed! React finds out what changes have been made, and changes only what needs to be changed. You will learn the various aspects of how React does this in the rest of this tutorial.
React Getting Started
To use React in production, you need npm which is included with Node.js.
Setting up a React Environment
If you have npx and Node.js installed, you can create a React application by using create-react-app.
If you've previously installed create-react-app globally, it is recommended that you uninstall the package to ensure npx always uses the latest version of create-react-app.
To uninstall, run this command: npm uninstall -g create-react-app.
Run this command to create a React application named my-react-app:
npx create-react-app my-react-app
The create-react-app will set up everything you need to run a React application.
Comments
Add new comment