@parataxic/gatsby-use-search
v0.4.0-alpha.47
Published
React use-search hook for gatsby
Downloads
6
Readme
yarn add @parataxic/gatsby-use-search
npm install @parataxic/gatsby-use-search
import { useSearch } from "@parataxic/gatsby-use-search";
const MyView:React.FC = () => {
const { hasMounted, inputRef, onInputChange, searchTerm } = useSearch();
return (
<>
<input
onChange={onInputChange}
placeholder="Search"
value={searchTerm}
ref={inputRef}
role="search"
/>
{hasMounted && "My results here, use hasMounted to avoid SSR flicker"}
</>
)
}