Closed yukukotani closed 11 months ago
Every handler except LayoutHandler can receive Context as a parameter. This PR allow LayoutHandler to access Context as well.
LayoutHandler
Context
I know that I'm hasty and need more discussion. I just want to show you what I want by code!
I'm working on https://github.com/kuma-ui/kuma-ui/pull/364. I'd like to use Context as a request-scoped dictionary in LayoutHandler to provide elegant API.
Rough example:
const handler: LayoutHandler = ({ children, head, c }) => { return ( <KumaRegistry context={c}> <html lang="en"> <head> {head.createTags()} <KumaHead context={c} /> </head> <body>...</body> </html> </KumaRegistry> ); }
@yukukotani
Sorry for to be late. LGTM!
Every handler except
LayoutHandler
can receiveContext
as a parameter. This PR allow LayoutHandler to accessContext
as well.I know that I'm hasty and need more discussion. I just want to show you what I want by code!
Background
I'm working on https://github.com/kuma-ui/kuma-ui/pull/364. I'd like to use
Context
as a request-scoped dictionary inLayoutHandler
to provide elegant API.Rough example: