That's a broad question. If using a front-end tool like React, you make the call to the back-end api, that might make a GET request to the database as in the article, in the useEffect hook.

The web page renders and while rendering is invoking the call to the database. After the data is recieved it is rendered to the page.

You shouldn't be grabbing so much data that it takes more than a second or two to display. But while it is fetching the data, you should show a loading image or loading skeleton.

This may help

https://medium.com/javascript-in-plain-english/using-reacts-useeffect-hook-to-fetch-data-and-periodically-refresh-that-data-2a69b6d44081

gravity well (Rob Tomlin)
gravity well (Rob Tomlin)

Written by gravity well (Rob Tomlin)

Software Engineering Manager. Explorer, learner, teacher, and more

No responses yet