UNPKG

@langgraph-js/sdk

Version:

The UI SDK for LangGraph - seamlessly integrate your AI agents with frontend interfaces

14 lines (13 loc) 532 B
/** * @zh useUnionStore Hook 用于将 nanostores 的 store 结构转换为更易于在 UI 组件中使用的扁平结构。 * @en The useUnionStore Hook is used to transform the nanostores store structure into a flatter structure that is easier to use in UI components. */ export const useUnionStore = (store, useStore) => { const data = Object.fromEntries(Object.entries(store.data).map(([key, value]) => { return [key, useStore(value)]; })); return { ...data, ...store.mutations, }; };