mirror of
https://github.com/uetchy/namae.git
synced 2025-03-17 12:30:32 +09:00
fix: init react-ga before mounting component
This commit is contained in:
parent
80d6270799
commit
82aaea6276
@ -1,8 +1,8 @@
|
|||||||
import React, {useState, useEffect} from 'react';
|
import React, {useState} from 'react';
|
||||||
import styled, {createGlobalStyle} from 'styled-components';
|
import styled, {createGlobalStyle} from 'styled-components';
|
||||||
import {Helmet} from 'react-helmet';
|
import {Helmet} from 'react-helmet';
|
||||||
import {useTranslation} from 'react-i18next';
|
import {useTranslation} from 'react-i18next';
|
||||||
import {initGA, sendQueryStatistics} from './util/analytics';
|
import {sendQueryStatistics} from './util/analytics';
|
||||||
|
|
||||||
import Welcome from './components/Welcome';
|
import Welcome from './components/Welcome';
|
||||||
import Form from './components/Form';
|
import Form from './components/Form';
|
||||||
@ -16,10 +16,6 @@ export default function App() {
|
|||||||
const [query, setQuery] = useState('');
|
const [query, setQuery] = useState('');
|
||||||
const {t} = useTranslation();
|
const {t} = useTranslation();
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
initGA();
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
function onQuery(query: string) {
|
function onQuery(query: string) {
|
||||||
setQuery(query);
|
setQuery(query);
|
||||||
sendQueryStatistics(query.length);
|
sendQueryStatistics(query.length);
|
||||||
|
@ -3,9 +3,10 @@ import ReactDOM from 'react-dom';
|
|||||||
import App from './App';
|
import App from './App';
|
||||||
import * as serviceWorker from './serviceWorker';
|
import * as serviceWorker from './serviceWorker';
|
||||||
import {FullScreenSuspense} from './util/suspense';
|
import {FullScreenSuspense} from './util/suspense';
|
||||||
import {initSentry} from './util/analytics';
|
import {initGA, initSentry} from './util/analytics';
|
||||||
import './util/i18n';
|
import './util/i18n';
|
||||||
|
|
||||||
|
initGA();
|
||||||
initSentry();
|
initSentry();
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user