question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Help Wanted] Is that possible for App Component have access to ctx.state

See original GitHub issue

Hello, everyone!

I am currently working on a project using Fresh (love it so for), and I am wondering “Is that possible for App Component has access to ctx.state

export default function App({ Component }: AppProps) {
 // somehow get data from ctx.state
  const { user } = ctx.state
  return (
   <div class={tw`h-screen bg-white dark:bg-black`}>
     <Head>
       <title></title>
       <style>
       {// I want to set some custom css variables based on user}
       {`:root { --color-who: '#fff'}`}
      </style>
     </Head>
     <Component />
   </div>
 )
}

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
lucacasonatocommented, Aug 31, 2022

I want to remove _app.{j|t}s{x}? soon, replacing it with a more generic _layout system. I’ll make sure to take into account middleware props in this system.

0reactions
kaldafcommented, Dec 12, 2022

Any updates?

Read more comments on GitHub >

github_iconTop Results From Across the Web

reactjs - Is it possible for a component to know where it was ...
A solution to this would involve passing the App component to a function which would crawl all the components rewrite the output such...
Read more >
Context - React
Context provides a way to pass data through the component tree without having to pass props down manually at every level. In a...
Read more >
Advanced Features: Custom `App` - Next.js
The App.getInitialProps receives a single argument called context.ctx . It's an object with the same set of properties as the context object in...
Read more >
Using React Context for state management in Next.js - Netlify
Context lets us pass data through the component tree without having to pass props down manually at every level. If you'd like to...
Read more >
How To Share State Across React Components with Context
There is shared data throughout the application. The Navigation component and the SaladItem component both need to know something about the user ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found