I can't get After.js (with Razzle) getInitialProps to work in functional components. Since I only use these kind of components (using hooks) I would need getInitialProps working with these components as well. Is there any way to do this?
I already tried suggestions from NextJS documentation using Component.getInitialProps before export but it doesn't seem to work.
const Component = () => { ... }
Component.getInitialProps = async ({ req, res, match, store, ...ctx }:any) => {
const setting = await fetch(apiUrl);
return { setting };
};
export default Component;
In this code I would expect to see the setting prop on the server version.