Replies: 1 comment
|
Hi, Unfortunately, AFAIK, Context is a
Though in your case there's a rather quick fix: 'use client'
// other imports
export const UserHeader = (/* Maybe some styling props? classNames and such? */) => {
const { user } = useUserContext(); // you can read context here
return (<h3 className="mb-4">Hello {user?.first_name}</h3>)
}And then use export default async function Home() {
return (
<div className="container-fluid">
<div className="row">
<div className="col-12">
<UserHeader />
<Suspense fallback={<OrgChooserSkeleton />}>
<OrgChooser />
</Suspense>
</div>
</div>
</div>
);
}And that should do the trick. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Summary
This UserProvider (found in the
layout.tsxfile below, works just fine if I put it in the Home page atapp > page.tsxAs soon as I try to move it to the
app > layout.tsxfile I get an error.Error:
app > layout.tsxapp > page.tsxapp > _context > userContext.tsxIf I missed any files that you guys need to help me please let me know. I am hard stuck on this and I have no idea what to do.
Additional information
No response
Example
No response
All reactions