Video wird geladen...

Video konnte nicht geladen werden

Zur Startseite

"How to share state between React client components with a parent server component?" 👇

51,557 Aufrufe • vor 1 Jahr •via X (Twitter)

9 Kommentare

Profilbild von 지후
지후vor 1 Jahr

Although it’s quite obvious, you did not add count-provider code

Profilbild von chuckstock
chuckstockvor 1 Jahr

is there a reason for using `use` instead of `useContext`?

Profilbild von Alex Sidorenko
Alex Sidorenkovor 1 Jahr

nope, same result

Profilbild von Kevin Nguyen
Kevin Nguyenvor 1 Jahr

This vs. Zustand what is your take?

Profilbild von Alex Sidorenko
Alex Sidorenkovor 1 Jahr

Depends on the type of the app. If it's an interaction-heavy app with a lot of state sharing -> client state lib, if not, context provider here and there is fine

Profilbild von Qing | quotion.co
Qing | quotion.covor 1 Jahr

This looks obvious, but what about sharing state between server and client components? I’m using queryparams, not ideal tbh

Profilbild von Alex Sidorenko
Alex Sidorenkovor 1 Jahr

Why not ideal?

Profilbild von Carlos Terrazas
Carlos Terrazasvor 1 Jahr

wouldn't it be better to zustand in each client component and thus avoid adding code in the server component? or is it just the demo with contextApi?

Profilbild von Alex Aaron Peña
Alex Aaron Peñavor 1 Jahr

if the context is defined server side, doesn’t this imply the single context is shared across all users visiting the web app? as I understand if I define a zustand datastore, wrap it in a provider, mount it on a server component, all users will share the same store

Ähnliche Videos