UNPKG

@roochnetwork/rooch-sdk-kit

Version:
19 lines (15 loc) 564 B
// Copyright (c) RoochNetwork // SPDX-License-Identifier: Apache-2.0 import { useContext } from 'react' import { useStore } from 'zustand' import { SessionStoreState } from '../provider/sessionStore.js' import { RoochContext } from '../provider/index.js' export function useSessionStore<T>(selector: (state: SessionStoreState) => T): T { const store = useContext(RoochContext) if (!store) { throw new Error( 'Could not find RoochSessionContext. Ensure that you have set up the RoochClientProvider.', ) } return useStore(store, selector) }