Mirror: The highly customizable and versatile GraphQL client with which you add on features like normalized caching as you grow.
at main 474 B view raw
1import React, { Fragment } from 'react'; 2import PropTypes from 'prop-types'; 3 4let GoogleAnalytics = null; 5if (typeof window !== 'undefined') { 6 GoogleAnalytics = require('react-router-ga'); 7 if (GoogleAnalytics.default) GoogleAnalytics = GoogleAnalytics.default; 8} 9 10export const Analytics = props => 11 !GoogleAnalytics ? ( 12 <GoogleAnalytics {...props} /> 13 ) : ( 14 <Fragment>{props.children}</Fragment> 15 ); 16 17Analytics.propTypes = { 18 children: PropTypes.element, 19};