firebase / firebase/friendlyeats-web
RootLayout - how to provide currentUser to entire app while maintaining RootLayout as a server component
- Dominant language
- JavaScript
- Stars
- 597
- Forks
- 456
- PR merge metrics
- No merged PRs in 30d
Description
Currently in the RootLayout, the `currentUser` is only provided to the `` component.
Is there a way to "provide" the `currentUser` to the entire app (including `` and its children), without making the RootLayout into a client component so that user related state is available not just in `Header` ?
```
export default async function RootLayout({ children }) {
const { currentUser } = await getAuthenticatedAppForUser();
return (
{children}
);
}
```
There are other Firebase + NextJS examples out there that wrap the entire `` tag in a React Context Provider - still figuring out if it is performant to make the RootLayout into a client component.
Thank you for any insights on this matter.
Contributor guide
Assessment
This issue has not been assessed yet.