What_is_React.md - z22756392z/wp109b Wiki

Original URL: https://github.com/z22756392z/wp109b/wiki/What_is_React.md

What is React?

It is a declarative, efficient, and flexible JavaScript library for building user interfaces

It lets you compose complex UIs from small and isolated pieces of code called #1.components.

Allow us to easily create #2.Single Page Apps -SPA's for short.


#1.components:

a components contain

template: it is like a place we contain html but it is jss (not javascript).

&

logic: something like javascript.

put it more simply components is just the function that return jss(template) with some js in it.

#2. how it work is:

the server only ever need to send a single html page to a browser for the website to run fully and then react takes over and manages the whole website in the browser including any kind of website data or user interactivity such as click events and even routing from page to so users can still navigate from page to page by clicking links in the website

But those new pages are not sent to the browsers from the server instead react changes all the content in the browser depending on the route of the url of the link that the user clicks for example: if a user clicks on the contact link then react will look at the url forward slash contact and then maybe inject a contact form onto the page so this process of react doing all of the work in the browser.

Means that the new page are loaded in really quickly and it results in very speedy users experience. Now this process is in contrast to traditional websites whereby every link a users clicks sends a request to the server for a new html page so if you click on a contact link traditionally without react it would send a request to the server. The server would look at this url and then would send it back an html page to the browser and it will be the same for every page.