I am trying to ensure that the same props are loaded on all pages I navigate to. My approach involves using _app.js
as shown below:
export default function MyApp({ Component, pageProps }) {
return <Component {...pageProps} />
}
MyApp.getInitialProps = async (appContext) => {
return {
props: {
testApp: ['1', '2', '3'],
testApp2: '222'
}
}
}
However, this method is not yielding the expected results as I am receiving an empty object:
const Error = (props) => {
console.log(props);
return (
<div className="error-page">
...
</div>
)
}
What mistake have I made in my approach?