[Help Wanted] Is that possible for App Component have access to ctx.state
See original GitHub issueHello, 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:
- Created a year ago
- Comments:7 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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.Any updates?