Skip to content

Instantly share code, notes, and snippets.

@jacobdo2
Created November 6, 2020 15:13
Show Gist options
  • Save jacobdo2/8cbddabb4f33901f02051df9d2c82b6e to your computer and use it in GitHub Desktop.
Save jacobdo2/8cbddabb4f33901f02051df9d2c82b6e to your computer and use it in GitHub Desktop.
import React from "react";
import _ from "lodash";
const search = _.debounce((value) => console.log(value), 500);
export default function SearchPage() {
const [inputValue, setInputValue] = React.useState("");
React.useEffect(() => {
search(inputValue);
}, [inputValue]);
return (
<input
type="text"
value={inputValue}
onChange={(e) => setInputValue(e.target.value)}
/>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment