Closed saraogipraveen closed 3 years ago
This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.
🔍 Inspect: https://vercel.com/itsnitinr/vscode-portfolio/36KKio1txg9H544Ri2u5eJqLYhNc
✅ Preview: https://vscode-portfol-git-fork-saraogipraveen-refactor-head-it-4e8bda.vercel.app
Hi @saraogipraveen, this is excellent. Thanks for contributing but I think there's an issue with titleText
as it is being evaluated to 'Home' irrespective of the page we're on except for the home page. Can you confirm if this happens on your end as well?
Hi @saraogipraveen, this is excellent. Thanks for contributing but I think there's an issue with
titleText
as it is being evaluated to 'Home' irrespective of the page we're on except for the home page. Can you confirm if this happens on your end as well?
@itsnitinr seems like the component's name gets changed into something else on deploy/build. There is an alternative by calling getStaticProps
from each page than reading it through pageProps
inside _app.js
, but then it will again populate each component. Let me know if this sounds good to you else we will discard this PR.
export async function getStaticProps(context) {
return {
props: {title: 'About'}, // will be passed to the page component as props
}
}
@saraogipraveen This is quite clever, nice! However, what do you think about defining getStaticProps()
over importing the <Head>
component into each page? Either way, thank you for the changes, and let me know which approach do you think would be better. I'll merge or revert back to the custom Head
tag on each page accordingly.
@itsnitinr I think later as the project grows, we might need to anyway use getStaticProps()
in pages as per requirement. This approach looks good to me. Also, importing <Head>
component once is better than importing <Head>
in each page
Makes sense. Good call!