@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.
13 lines (10 loc) • 441 B
text/typescript
import type { FormFieldArray, FormFieldNames } from './types.js'
import { useFormStore } from './useFormStore.js'
// We should return a strongly-typed array based on the specific field names we pass to the function.
export const useFieldValues = <T extends FormFieldNames[]>(...names: T) => {
const values = useFormStore(
(store) =>
names.map((name) => store.userValues[name]?.value) as FormFieldArray<T>
)
return values
}