import React from "react"; import { getGoogleApiKey } from "../services/ggsh.service"; import Loading from "./loading.component"; const withGoogleApiKey = ComposedComponent => class extends React.Component { constructor(props) { super(props); this.state = { googleApiKey: null } } async componentDidMount() { const googleApiKey = await getGoogleApiKey(); this.setState({ googleApiKey }); } render() { const { googleApiKey } = this.state; if (!googleApiKey) { return } return } } export default withGoogleApiKey;