Best way to insert preloader on screen

Hi

I’m creating an app to get data from WordPress site via API, when app is getting data, can i display a spinner or preloader screen before all data is loaded?

Can i use simple and common preloader JS?

How do it?