Skip to content
Discussion options

You must be logged in to vote

It is not recommended, but you could pass them like...

pages/index.js

function Index(){}
Index.isHome = true
export default function Index

_app.js

function MyApp({Component,pageProps}){
  console.log(Component.isHome)
  return <Component {...pageProps}/>
}

A better way to handle it would be to use getStaticProps (or getServerSideProps) on your pages/index.js and return that flag in props and then use pageProps in your _app to determine if the flag was set.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@HamzaAmar
Comment options

Answer selected by HamzaAmar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants