UNPKG

@lifi/widget

Version:

LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.

18 lines (14 loc) 487 B
import { useContext } from 'react' import { shallow } from 'zustand/shallow' import { FormStoreContext } from './FormStoreContext.js' import type { FormValuesState } from './types.js' export function useFormStore<T>( selector: (state: FormValuesState) => T, equalityFn = shallow ): T { const useStore = useContext(FormStoreContext) if (!useStore) { throw new Error('You forgot to wrap your component in <FormStoreProvider>.') } return useStore(selector, equalityFn) }