use react suspense with dom code example
Example 1: enable concurrent mode in recat
//It stops rendering of element to have a better UX
//Go to index.js and make the following changes:-
ReactDOM.createRoot(document.getElementById('root')).render(<App />);
Example 2: suspense react
import React, {Suspense} from 'react;
const ProfilePage = React.lazy(() => import('./ProfilePage')); // Lazy-loaded
// Show a spinner while the profile [data fetching] is loading
<Suspense fallback={<Spinner />}>
<ProfilePage />
</Suspense>