Warning: You have opted-out of Automatic Static Optimization after following with-redux-wrapper example #14537
-
Hey everyone! I followed
Is this intended to happen? I am 100% sure there's no getInitialProps in my Here's the code of my app file:type Props = {
login: typeof login;
user: IDashUser | null;
};
const mapDispatchToProps = (dispatch: Dispatch) => {
return {
login: bindActionCreators(login, dispatch),
};
};
const mapStoreToState = (store: any) => {
return {
user: store.user,
};
};
class MyApp extends App<Props> {
async componentDidMount() {
// Log In the client
const { login, user } = this.props;
if (!user) {
login();
}
// Remove the server-side injected CSS.
const jssStyles = document.querySelector("#jss-server-side");
if (jssStyles) {
jssStyles.parentElement!.removeChild(jssStyles);
}
}
public render() {
const { Component, pageProps } = this.props;
return (
<Fragment>
<CssBaseline />
<Component {...pageProps} />
</Fragment>
);
}
}
export default wrapper.withRedux(connect(mapStoreToState, mapDispatchToProps)(MyApp)); |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
The If you want to take advantage of the Automatic Static Optimization then you should you the per page wrapper with the hydration that @kirill-konshin built-in in version 6: https://github.com/kirill-konshin/next-redux-wrapper#usage |
Beta Was this translation helpful? Give feedback.
The
next-redux-wrapper
lib usesgetInitialProps
under the hood when you wrap the_app.js
: https://github.com/kirill-konshin/next-redux-wrapper#app.If you want to take advantage of the Automatic Static Optimization then you should you the per page wrapper with the hydration that @kirill-konshin built-in in version 6: https://github.com/kirill-konshin/next-redux-wrapper#usage