getInitialProps
в App
export default function App({ Component, pageProps }) {
console.log(pageProps.data, "data");
return (
<>
<Layout data={pageProps.data}>
<Component {...pageProps} />
</Layout>
</>
);
}
App.getInitialProps = async () => {
...
pageProps["data"] = "some data";
return { pageProps };
};