Skip to content

Commit

Permalink
Type errors loaders
Browse files Browse the repository at this point in the history
  • Loading branch information
taneliang committed Dec 1, 2018
1 parent 21740e3 commit 580eb0a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,11 +1,16 @@
import React from 'react';
import { withRouter } from 'react-router-dom';
import { withRouter, RouteComponentProps } from 'react-router-dom';
import ReactGA from 'react-ga';

type Props = {} & RouteComponentProps<{}>;

// Adapted from https://stackoverflow.com/a/47385875/5281021
class GoogleAnalytics extends React.Component {
componentDidUpdate({ location, history }) {
ReactGA.initialize(process.env.REACT_APP_GA_TRACKING_ID, {
class GoogleAnalytics extends React.Component<Props> {
componentDidUpdate({ location, history }: Props) {
const { REACT_APP_GA_TRACKING_ID } = process.env;
if (!REACT_APP_GA_TRACKING_ID) return;

ReactGA.initialize(REACT_APP_GA_TRACKING_ID, {
debug: process.env.NODE_ENV === 'development',
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
import React from 'react';
import styles from './ErrorsLoaders.module.scss';

export default function Error({ title, message }) {
interface Props {
title: string;
message: string;
}

const Error: React.FunctionComponent<Props> = ({ title, message }) => {
return (
<section className={styles.container}>
<h2>{title}</h2>
<div>{message}</div>
</section>
);
}
};

export default Error;

0 comments on commit 580eb0a

Please sign in to comment.