Created
May 8, 2019 04:49
-
-
Save gaperton/4f0ac8d5a44bfd60cfd782eea66af1b3 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const DelayedInput = ({ $value, timeout = 1000, ...props }) => { | |
const $inputValue = useBoundLink( $value ) | |
.onChange( | |
useThrottle( | |
x => $value.set( x ), | |
timeout, | |
[ $value.value ] | |
) | |
); | |
return <input {...$inputValue.props} {...props}/>; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment