import {ReactElement} from "react";
import {Link} from "react-router-dom";

export function LoadingData({data, children}: {data: object|null|undefined, children: ReactElement}) {

    if (data === null){
        return <div className={"loading"}>Идёт загрузка...</div>
    }
    if (data === undefined){
        return <Link className={"not-found"} to={"/"}>404 НИЧЕГО НЕ НАЙДЕНО</Link>
    }
    return children;

}