【发布时间】:2022-01-20 03:14:26
【问题描述】:
我用 redux 包装器创建了一个 nextjs 应用程序
class MyApp extends React.Component<AppProps> {
public static getInitialProps = wrapper.getInitialAppProps(store => async ({ Component, ctx }) => {
我现在正在尝试将谷歌分析集成到应用程序 (G4)。尽管许多文档解释了如何使用 useEffect 添加,但指南在应用扩展组件而不使用钩子时如何使用它们几乎没有脱节。
我需要使用 componentMount 方法还是存在更好的方法,例如将此实现升级为功能组件?
【问题讨论】:
标签: reactjs redux react-redux react-hooks next.js