How to use the serialize-query-params.parse function in serialize-query-params

To help you get started, we’ve selected a few serialize-query-params examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github learn-anything / learn-anything / pages / index.tsx View on Github external
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>
github pbeshai / use-query-params / src / useQueryParam.ts View on Github external
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]);
  }
github pbeshai / use-query-params / src / __tests__ / helpers.ts View on Github external
export function calledReplaceQuery(
  history: ReturnType,
  index: number = 0
) {
  return parseQueryString(history.replace.mock.calls[index][0].search);
}
github pbeshai / use-query-params / src / __tests__ / helpers.ts View on Github external
export function calledPushQuery(
  history: ReturnType,
  index: number = 0
) {
  return parseQueryString(history.push.mock.calls[index][0].search);
}
github pbeshai / use-query-params / src / useQueryParams.ts View on Github external
  const rawQuery = React.useMemo(() => parseQueryString(search) || {}, [
    search,
github feathericons / feathericons.com / src / pages / index.js View on Github external
function IndexPage({ location }) {
  const [query, setQuery] = useQueryParam(
    'query',
    StringParam,
    parse(location.search),
  )
  const results = useSearch(query || '')

  return (
    
      
      <div>
        </div>

serialize-query-params

A library for simplifying encoding and decoding URL query parameters.

ISC
Latest version published 2 years ago

Package Health Score

58 / 100
Full package analysis