From 9921e5210a30845254d030d81b29e95ec58da6ed Mon Sep 17 00:00:00 2001 From: Tat Dat Duong Date: Thu, 13 Mar 2025 17:08:10 +0100 Subject: [PATCH] feat(docs): feedback on gen ui docs --- docs/docs/cloud/how-tos/generative_ui_react.md | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/docs/cloud/how-tos/generative_ui_react.md b/docs/docs/cloud/how-tos/generative_ui_react.md index 052f6fb6e..14b0dd097 100644 --- a/docs/docs/cloud/how-tos/generative_ui_react.md +++ b/docs/docs/cloud/how-tos/generative_ui_react.md @@ -217,7 +217,7 @@ By default `LoadExternalComponent` will use the `assistantId` from `useStream()` ### Access and interact with the thread state from the UI component -You can access the thread state from the UI component by using the `useStreamContext` hook. +You can access the thread state inside the UI component by using the `useStreamContext` hook. ```tsx import { useStreamContext } from "@langchain/langgraph-sdk/react-ui"; @@ -256,8 +256,14 @@ You can pass additional context to the client components by providing a `meta` p Then, you can access the `meta` prop in the UI component by using the `useStreamContext` hook. ```tsx +import { useStreamContext } from "@langchain/langgraph-sdk/react-ui"; + const WeatherComponent = (props: { city: string }) => { - const { meta } = useStreamContext(); + const { meta } = useStreamContext< + { city: string }, + { MetaType: { userId?: string } } + >(); + return (
Weather for {props.city} (user: {meta?.userId})