Fetch is browser API ,it is used to make AJAX call to server without disturbing full page of application, it resides in window object of the browser.
Fetch API send a AJAX request with corresponding input request[User provided ] to server then server response to that request.
.then(response => response.json())
.then(json => console.log(json)).catch(err=>console.log(err))
Headers :- provide header information like content-type, Auth -token etc..
Method :- Type of http request like GET , POST ,PUT , DELETE, PATCH etc…
Then and catch :- Both are callbacks, Then executes once request resolves successfully, it may contains multiple then block first then block response is passed to another then block
The initial loading of SPA is quite slow because of bundle should download before it loads to users.
Yes, we should go for Hydration.
Example:- Vuejs has NUXT to solve this problem.
JWT is JSON web token, It has an information about expire date, email etc.., It helps to validate your request once you loggedIn to website. it was issued by server with secrete.
Yes, You can see the information of jwt but you can’t change the information because server generated jwt…
The huge dynamic data stored in database. The frontend request for data in backend using API.
API is a pice of code helps to interact with database data on the internet.
JSON format has a key value pair data format, it is an efficient data format to transfer data between frontend to backend.
Var keyword has global Or Function scope, it can be re-declared inside its scope, variable should be followed by var.
var y=90; // declare
console.log(y); // 90
Let keyword has Block scope, It can’t be re-declared and can’t access…