Answer the question
In order to leave comments, you need to log in
How to prevent constant requests for the same page without reloading?
Tell me, please, I couldn’t find anything about this: I’m making an online store using SSR on NEXT js.
I have 2 pages Home and Cart. and here's the problem: every time I switch to the cart and return to the main page, I again make a request behind the main page, although I received it before. Is it possible to somehow make the page be given 1 time, and in subsequent times what I received the 1st time is loaded (in case I did not reload the page)?
Answer the question
In order to leave comments, you need to log in
Well, since csr is better to receive the page on the server and give it to the client already ready, in this case you will not see the request through the development tools at all, and as for the two requests, then most likely you receive through hooks, so you need to use loading through empty dependencies to download the data only once when downloading the data.
useEffect = (()=>{запрос},[])
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question