Bhargav Kumar
Bhargav Kumar

Reputation: 1

How does React dynamic content rendered without out logging api calls in browser

I'm planning on developing a E-Commerce application using React.

Can someone tell me how can I create a SPA application like Netflix, Walmart etc. without logging the API calls required for data fetching on the user browser.

eg: Do an activity on Walmart and Netflix and there will be no change in the network tab but the functionality will be as smooth as CSR application.

I have tried Next.JS to render static pages and some part of all the pages without API calls but even with that I was not able hide the API calls for Dynamic content updates

Upvotes: 0

Views: 42

Answers (1)

Max
Max

Reputation: 136

In don't know any way to hide HTTP requests from network logging (I guess you are talking about Chrome or Firefox Dev Tools). I neither find any reason to do this. Logging network calls is a healthy way for the user to know what happens under the hood of an app. I you want to hide the logs, maybe that's because you are trying to achieve some HTTP calls containing unsecure data from the user, or containing data from the server that you don't want the user to know. In either case, that is probably the point that you need to work on, instead of searching for a tweak to hide this communication client/server.

You maybe need access control policy (auth) for some parts of you app for example ? Or maybe you need, if you're using Next.js, to build some API Routes to only send to the client the required "public" data ?

You can also, like you said at the end of your question, use React Server Components (RSC), to build HTML server-side and only send this to the client. You can achieve to make some dynamic behaviour using RSC with Next.js : check loading UIs and Suspense

Hope I understood correctly your need, and my answer helps you 😉

Upvotes: 0

Related Questions