Subscriptions and observables in AppRouter Server components #51035
Unanswered
Boimb
asked this question in
App Router
Replies: 1 comment
-
It would be nice if Observable or AsyncIterable could be passed to client components via prop and then used via const kv = await Deno.openKv("my_db.sqlite")
export default function Page() {
const updates = kv.watch(["rooms", 123]) // returns AsyncIterable
return (
<Suspense fallback={<Spinner />}>
<RoomView updates={updates} />
</Suspense>
)
} 'use client'
export function RoomView(props: { updates: AsyncIterable<RoomData> }) {
const room = use(props.updates)
return <>
<h1>Welcome to room {room.title}!</h1>
<p>We have {room.members.length} participants.</p>
</>
} |
Beta Was this translation helpful? Give feedback.
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.
-
Hi,
New to Nextjs I try to use the latest v13 and embrace the Server/Client Components paradigm, basically, fetching my data in a Server component.
I'm currently facing 2 issues:
Consequence is that I'm basically keeping all this logic on the client side, thing I'd like to avoid.
I know all of this is quite new, but, are there any tricks out there to handle this?
Thx for your help
Beta Was this translation helpful? Give feedback.
All reactions