1. Introduce about React Js app
React.js, commonly referred to as React, is a JavaScript library for building user interfaces (UIs) and front-end applications. Developed and maintained by Facebook, React is widely used for creating interactive and dynamic user interfaces in web applications.
- Key features Component-Based Architecture: React applications are built using a component-based architecture. Components are reusable, self-contained building blocks that encapsulate a part of the user interface. This makes it easier to manage and scale complex applications.of React include:
- Virtual DOM (Document Object Model): React uses a virtual DOM to improve performance. Instead of directly manipulating the browser’s DOM, React creates a virtual representation of it in memory. When there are changes, React calculates the most efficient way to update the actual DOM, minimizing the need for direct manipulation and improving application performance.
- Declarative Syntax: React uses a declarative syntax, allowing developers to describe how the UI should look and behave based on the application state. This is in contrast to an imperative approach, where developers would explicitly specify each step to achieve a desired outcome.
- JSX (JavaScript XML): React introduces JSX, a syntax extension that allows mixing HTML-like code with JavaScript. JSX makes it easier to write and understand the structure of components.
- Unidirectional Data Flow: React follows a unidirectional data flow, meaning that data flows in a single direction through the application. This helps maintain a clear and predictable state management, making it easier to debug and understand how data changes over time.
- React Router: React Router is a library that enables navigation and routing in React applications. It allows developers to define different views for different parts of the application and handle navigation between them.
- React Hooks: Hooks are functions that enable the use of state and lifecycle features in functional components. They provide a way to manage state and side effects in functional components, making it possible to use stateful logic without using class components.
2. Create Simple React Js app
To Create simple React Js app, You need install Node and Npm to your PC. You’ll need to have Node >= 14.0.0 and npm >= 5.6 on your machine.
Open terminal (cmd on windown) and run
npx create-react-app my-app
After creating app, you can go to the folder app, in my case, I will go to my-app folder
cd my-app
You can run app by command line:
npm start
After that, you can go to your browser by link http://localhost:3000
Conclusion: React js is a library for web and native user interfaces. it is very good for build front-end web about user friendly, speed scale up or more.