useRecoilDebouncedValue
#
DescriptionDebounce Recoil state setter.
It is often used with eva-sdk-react-recoil
, when a service request changes based on an input value.
#
Usageimport { atom } from 'recoil';import { useRecoilDebouncedValue } from '@springtree/eva-suite-react-hooks';
const ExampleAtom = atom<string | undefined>({ key: 'ExampleKey', default: undefined,});
const Example = () => { const [inputValue, setInputValue] = useRecoilDebouncedValue(ExampleAtom);
return ( <> <input type="text" value={inputValue ?? ''} onChange={(event) => setInputValue(event.target.value)} > <span> {`The current value is: ${inputValue ?? 'undefined'}`} </span> </> );};
export default Example;