import { GetServerSideProps } from 'next'; import { useQuery } from '@apollo/react-hooks'; import Head from 'next/head'; import { initializeApollo } from '../../../../../lib/apolloClient'; import Nav from '../../../../../components/home/Nav'; import About from '../../../../../components/resource/About'; import DataExplorer from '../../../../../components/resource/DataExplorer'; import { GET_RESOURCES_QUERY } from '../../../../../graphql/queries'; function Resource({ variables }) { const { data, loading } = useQuery(GET_RESOURCES_QUERY, { variables }); if (loading) return
Loading
; const result = data.dataset.result; // Find right resource const resource = result.resources.find( (item) => item.name === variables.resource ); return ( <> Portal | {resource.title || resource.name}