Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// process Shell.getInitialProps
// use global props appProps as shell default props
const shellProps = { ...appProps };
if (withSSR && AppShell !== null && window.__INITIAL_DATA__.shellData !== null) {
Object.assign(shellProps, window.__INITIAL_DATA__.shellData);
}
// process App.getInitialProps
if (withSSR && window.__INITIAL_DATA__.appData !== null) {
Object.assign(appProps, window.__INITIAL_DATA__.appData);
}
// Render
if (hydrate) {
// Avoid router empty initialComponent
getCurrentComponent(appProps.routerConfig.routes, withSSR)().then(function(InitialComponent) {
if (InitialComponent !== null) {
appProps.routerConfig.InitialComponent = InitialComponent;
}
processRenderWebApp(shellProps);
});
} else {
processRenderWebApp(shellProps);
}
}
};
<button> router.push('/about')}>Go about</button>