import { RouteComponentProps } from '@reach/router' ; import { ApiRxContext } from '@substrate/context' ; import { Loading } from '@substrate/ui-components' ; import React , { useContext } from 'react' ; import { LoadableHeader } from './Header' ; interface Props extends RouteComponentProps { children : React . ReactNode ; } export function Layout ( props ) { const { children } = props ; const { isApiReady } = useContext ( ApiRxContext ) ; return ( < > < LoadableHeader { ... props } / > { isApiReady ? children : < Loading active / > } < />); }