I tried using the enhanceApp or enhanceComponent but the prop or static property never reaches _app for some reason.
ctx.renderPage = () =>
originalRenderPage({
enhanceApp: (App) => {
App.nonce = nonce;
return App;
},
enhanceComponent: (Component) => {
Component.nonce = nonce;
return Component;
}
});
Or even:
ctx.renderPage = () =>
originalRenderPage({
enhanceApp: (App: AppType | React.ComponentType<{nonce: string}>) =>
function EnhancedApp(props) {
return <App {...props} nonce={nonce} />;
}
});
Obs.: I cannot add a
getInitialPropsin app because I need static page optimization.
Is this the right approach? Any help would be greatly appreciated.