Beruflich Dokumente
Kultur Dokumente
React is a JS library for building fast and interactive user interface for web and
mobile apps
React is open source means any user can access the sourcecode (modify and enhance
it)
In model view architecture, react is the view which is responsible for app's look
and feel
------------------------
Why its popular?
------------------------
Features of React?
1. JSX
By JSX we can add HTML to javascript files. It helps easier the code to understand
and debug
JS + HTML = JSX;
(const app =) is JS
(<h1>Hello</h1>) is HTML
; is JS
2. Virtual DOM
React creates a virtual DOM that exact a copy of real dom. Traditionally when ever
something chnages in webapplication, all objects in real dom are updated. This
makes web app slower.
3. Performace
5. Extensions
React has many extensions, that we can use for full fledged web app.
It provide server side rendering.
React Native, Flux, Redux
6. Debugging
------------------------
Bulding blocks of React
1. Components
Components are bulding blocks of react application. Single app consists of multiple
component.
eg. A website have header component, footer component and inside body lots of
components are there.
Types of Compenents
2. State
State of a compenent is a object that hold data and that can change on period of
time.
Its the data used for the compenent to render.
Render method is responsible for how the UI looks.
Every time state chnage react re-render the component to browser.
State object can store multiple properties.
this.setState() is used to change the value of state object.
3. Props
Its called properties. It allow to pass arguments or data to components
-------------------------------
props vs state