Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const IndexPage: FunctionComponent = ({ location }) => {
const [query, setQuery] = useQueryParam(
"query",
StringParam,
parse(location)
);
const handleOnChange = (event: ChangeEvent) => {
setQuery(event.target.value);
};
return (
<div>
<title>Learn Anything</title>
{/* </div>
rawQuery = React.useMemo(() => {
let pathname = {};
// handle checking SSR (#13)
if (locationIsObject) {
// in browser
if (windowIsDefined) {
pathname = parseQueryString(location.search);
} else {
// not in browser
let url = location.pathname;
if (location.search) {
url += location.search;
}
pathname = parseQueryURL(url).query;
}
}
return pathname || {};
}, [location.search, location.pathname, locationIsObject, windowIsDefined]);
}
export function calledReplaceQuery(
history: ReturnType,
index: number = 0
) {
return parseQueryString(history.replace.mock.calls[index][0].search);
}
export function calledPushQuery(
history: ReturnType,
index: number = 0
) {
return parseQueryString(history.push.mock.calls[index][0].search);
}
const rawQuery = React.useMemo(() => parseQueryString(search) || {}, [
search,
function IndexPage({ location }) {
const [query, setQuery] = useQueryParam(
'query',
StringParam,
parse(location.search),
)
const results = useSearch(query || '')
return (
<div>
</div>