// DataMap.tsx import React from 'react' import { useFragment } from 'react-relay/hooks' import * as PropTypes from 'prop-types' import { InferProps } from 'prop-types' import { graphql } from 'react-relay' import MapComponent from './Map.js' // import GeocodeQuery from './__generated__/GeocodeQuery.graphql' // Adjust the import path // type DataMapProps = { // queryReference:Data; // } const FRAGMENT = graphql` fragment DataMapCoordinatesFragment on GeoCoordinates { latitude longitude } ` function DataMap({ data, ...otherProps }: InferProps): React.ReactElement { const result = useFragment( FRAGMENT, data, ) const { latitude, longitude, } = result if (!latitude || !longitude) { return No valid coordinates } return ( ) } DataMap.propTypes = { /** The query reference to use */ data:PropTypes.object.isRequired, /** The query to use */ QUERY:PropTypes.object, /** Accessor to the data in the query response */ accessor:PropTypes.string, } export default DataMap