@dynamic-labs/sdk-react-core
Version:
A React SDK for implementing wallet web3 authentication and authorization to your website.
19 lines (16 loc) • 701 B
JavaScript
'use client'
import { jsx } from 'react/jsx-runtime';
import { createContext, useRef, useContext } from 'react';
import { DynamicError } from '@dynamic-labs/utils';
const FieldsStateContext = createContext(undefined);
const FieldsStateProvider = ({ children }) => {
const selectedPhoneCountry = useRef();
return (jsx(FieldsStateContext.Provider, { value: { selectedPhoneCountry }, children: children }));
};
const useFieldsState = () => {
const context = useContext(FieldsStateContext);
if (!context)
throw new DynamicError('Can only call useFieldsState inside FieldsStateProvider');
return context;
};
export { FieldsStateContext, FieldsStateProvider, useFieldsState };