"use client" /** * This is component for initialization any things on the client side once on application loading. * It works only **once** for a cycle of **soft navigations**. * It could be useful for init some redux states on first load **OR** on hard reloading of the page if needed. * The component **should** be placed on the `RootLayout` level to correct work. */ import { useEffect, useRef } from "react"; interface PreloaderProps {} export default function Preloader(props: Readonly): null { const loaded = useRef(false); useEffect(() => { if (!loaded.current) { // TODO: some logic required to be initially preloaded once loaded.current = true; console.log((new Date()).toISOString(), "PRELOADER INITIALIZED"); } }, [loaded]); return null; }