import React, { PureComponent } from 'react' import styles from './HostnameCheck.module.scss' const allowedHosts = [ 'matthiaskretschmann.com', 'beta.matthiaskretschmann.com', 'localhost' ] export default class HostnameInfo extends PureComponent { checkAllowedHost = () => { if (typeof window !== 'undefined' && window.location) { return allowedHosts.includes(window.location.hostname) } } state = { isAllowedHost: true } componentDidMount() { const isAllowedHost = this.checkAllowedHost() this.setState({ isAllowedHost }) } render() { if (this.state.isAllowedHost) return null return ( <> ) } }