mirror of
https://github.com/uetchy/namae.git
synced 2025-03-17 04:30:31 +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 {Helmet} from 'react-helmet';
|
||||
import {useTranslation} from 'react-i18next';
|
||||
import {initGA, sendQueryStatistics} from './util/analytics';
|
||||
import {sendQueryStatistics} from './util/analytics';
|
||||
|
||||
import Welcome from './components/Welcome';
|
||||
import Form from './components/Form';
|
||||
@ -16,10 +16,6 @@ export default function App() {
|
||||
const [query, setQuery] = useState('');
|
||||
const {t} = useTranslation();
|
||||
|
||||
useEffect(() => {
|
||||
initGA();
|
||||
}, []);
|
||||
|
||||
function onQuery(query: string) {
|
||||
setQuery(query);
|
||||
sendQueryStatistics(query.length);
|
||||
|
@ -3,9 +3,10 @@ import ReactDOM from 'react-dom';
|
||||
import App from './App';
|
||||
import * as serviceWorker from './serviceWorker';
|
||||
import {FullScreenSuspense} from './util/suspense';
|
||||
import {initSentry} from './util/analytics';
|
||||
import {initGA, initSentry} from './util/analytics';
|
||||
import './util/i18n';
|
||||
|
||||
initGA();
|
||||
initSentry();
|
||||
|
||||
ReactDOM.render(
|
||||
|
Loading…
x
Reference in New Issue
Block a user