We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Had an issue with this code
import ReactGA from 'react-ga4'; export const initGA = () => { ReactGA.initialize('***'); }; export const logPageView = (page: string) => { ReactGA.send({ hitType: 'pageview', page }); }; export const logEvent = (category: string, action: string, label?: string) => { ReactGA.event({ category, action, label }); };
Where calling initGA, logPageView, logEvent from any components will cause Error: initialize, send, event are not functions.
Error:
,
are not functions
Im using React: 18.3.1 React DOM: 18.3.1 react-ga4: 2.1.0 TypeScript: 5.6.3 Webpack/Esbuild: Esbuild
My solution was to use default. E.g. ReactGA.default.initialize('***');
default
ReactGA.default.initialize('***');
Is there any solution without using default?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Had an issue with this code
Where calling initGA, logPageView, logEvent from any components will cause
Error:
initialize,
send,
eventare not functions
.Im using
React: 18.3.1
React DOM: 18.3.1
react-ga4: 2.1.0
TypeScript: 5.6.3
Webpack/Esbuild: Esbuild
My solution was to use
default
. E.g.ReactGA.default.initialize('***');
Is there any solution without using
default
?The text was updated successfully, but these errors were encountered: