before show
This commit is contained in:
14
src/components/LoadingData.tsx
Normal file
14
src/components/LoadingData.tsx
Normal file
@@ -0,0 +1,14 @@
|
||||
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;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user