A JavaScript library for building user interfaces ๐ it is declarative
-
Components: React is built around the concept of components, which are self-contained UI elements that can be reused throughout your application.
-
Virtual DOM: React uses a virtual representation of the DOM, which is more efficient than directly manipulating the actual DOM.
-
State management: React provides a way to manage state with in components, which makes it easier to build complex UIs.
-
JSX: React uses a syntax extension called JSX, which allows you to write HTML-like code within your JavaScript files.
Install Node First https://nodejs.org/en/
npm install -g npm@latest
npm init react-app tech-app
cd tech-app
npm start
npx create-react-app tech-app
cd tech-app
npm start
npm create vite@latest
cd tech-app
npm install
npm run dev
- JSX (JavaScript XML) is a syntax extension used in React to describe the structure of user interface components in a more concise and intuitive way. It allows you to write HTML-like code directly in your JavaScript files, which is then transformed into JavaScript objects by the transpiler (such as Babel) before it's run by the browser.
const element = React.createElement(
'h1',
{ className: 'greeting' },
'Hello, world!'
);
You can write the same thing using JSX like this:
const element = <h1 className="greeting">Hello, world!</h1>;
-
In this example, the JSX code is transformed into the same React.createElement call that we wrote before.
-
JSX allows you to easily compose complex UI components using a familiar syntax. It also allows you to use JavaScript expressions within the markup, which enables dynamic and data-driven rendering of UI components.
-
While JSX is not required to use React, it has become a widely adopted convention within the React community because of its many benefits
- Hello World
- Introducing JSX
- Rendering Elements
- Components and Props
- State and Lifecycle
- Handling Events
- Conditional Rendering
- Lists and Keys
- Forms
- Lifting State Up
- Composition vs Inheritance
- Thinking In React
"use strict";
ReactDOM.render( /*#__PURE__*/React.createElement("h1", null, "Welcome to react App"), document.getElementById('root'));
rfc
rafc
This project was bootstrapped with Create React App.