08. ReactJS
08. ReactJS
ReactJS
Prepared by Web
team
I. ReactJS Overview
II. Environment Setup
III.JSX & Components
Content IV.List & Key
V. React Hooks
VI.Component Life Cycle
VII.State & Props
Overview
Overview
⎊ Introduction
- ReactJS is a JavaScript library used for building
reusable UI components.
- It is a language for user interfaces, can be
compared to Angular & Vue.
- It is used at the client side and can be integrated
with other CSS frameworks like TailwindCSS.
Overview
⎊ Features
- JSX : It is a JavaScript syntax extension. It isn’t
necessary to use JSX in React development, but it
is recommended.
- Components : React is all about components.
Those components are all rendered in the client
side.
Overview
⎊ Features (cont.)
- One-way Data Binding : The data in react flows
only in one direction which means that the
properties (props) in the child component cannot
return the data to its parent component.
- Performance : react uses virtual DOM and
updates only the modified parts.
Overview
⎊ Features (cont.)
- Simplicity : ReactJS is a component-based which
makes the code reusable and it uses JSX which is a
combination of HTML and JavaScript. This makes
code easy to understand and debug.
Overview
⎊ Advantages of ReactJS
- It can be used on client and server side as well as
with other frameworks.
- Components and data patterns improve readability,
which helps to maintain larger apps.
Overview
⎊ Advantages of ReactJS
- React utilizes a virtual DOM, which is an in-memory
representation of the actual DOM. This allows
ReactJS to efficiently update and render only the
components that have changed, instead of re-
rendering the entire page.
Environment
Setup
Environment Setup
⎊ ReactJS requires NodeJS to run
- Install NodeJS and npm (Node.js)
function OutputComponent() {
return (
<div>OutputComponent</div>
)
}
export default OutputComponent
Components
⎊ Importing and Exporting ReactJS Components
- There are 2 ways to export and import components (or
values) in ReactJS :
1. Named export and import
2. Default export and import
Components
⎊ Named Export
- To export multiple functions into another components as
a named export, we just need to use the export
keywords in front of the functions.
- We can use curly braces { } to export more than one
named export instead of exporting individually.
Components
⎊ Example
import React from "react";