You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is highly recommended to use `pages/_app` to wrap all pages at once, otherwise due to potential race conditions you may get `Cannot update component while rendering another component`:
:warning: Next.jsprovides [generic`getInitialProps`](https://github.com/vercel/next.js/blob/canary/packages/next/pages/_app.tsx#L21) when using `class MyApp extends App` which will be picked up by wrapper, so you **must not extend `App`** as you'll be opted out of Automatic Static Optimization: https://err.sh/next.js/opt-out-auto-static-optimization. Just export a regular Functional Component as in the example above.
149
+
150
+
```typescript
151
+
import React from 'react';
152
+
import {wrapper} from '../components/store';
153
+
import {AppProps} from 'next/app';
154
+
155
+
class MyApp extends React.Component<AppProps> {
156
+
render() {
157
+
const {Component, pageProps} = this.props;
158
+
return <Component {...pageProps} />;
159
+
}
160
+
}
161
+
162
+
export default wrapper.withRedux(MyApp);
163
+
````
145
164
146
165
<details>
147
166
<summary>Same code in JavaScript (without types)</summary>
@@ -681,60 +700,61 @@ import {Action} from 'redux';
0 commit comments