Socket
Socket
Sign inDemoInstall

use-browser-search-param

Package Overview
Dependencies
5
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    use-browser-search-param

This error occurs when the `history`, `location`, and / or `URL` provided to `usableSearchParams` does not exist or is invalid. Either 1) the global environment does not have a valid `history`, `location`, and / or `URL` API; or 2) the custom-provided `hi


Version published
Weekly downloads
1
Maintainers
1
Install size
4.86 kB
Created
Weekly downloads
 

Readme

Source

Peer dependency API error

This error occurs when the history, location, and / or URL provided to usableSearchParams does not exist or is invalid. Either 1) the global environment does not have a valid history, location, and / or URL API; or 2) the custom-provided history, location, and / or URL API is invalid.

In either case, here's what this library needs in terms of a "valid" history, location, and URL API:

  • A "valid" history API must include a pushState method. This library uses history.pushState to change the current search params without causing a page refresh. You can read more about the history API here.
  • A "valid" location API must include a toString method. This library uses location.toString to determine the current value of the address bar when getting or setting search params.
  • A "valid" URL API

Case number one would happen, for example, if you use this library from a non-browser environment (e.g. node or react native) or a browser environment that does not support history, location, or URL. You can find polyfills and shims online (if you want you can read here for more about those terms) to help fill in the missing API(s). No particular polyfills or shims are yet confirmed to work with this library, so if you try one and it works or doesn't work, please tell us about it, so we can update these docs. Here are some links to try anyways:

Case number two would happen, for example, if you improperly configure usableSearchParams to work with react router. If so, make sure you are passing react router's history

FAQs

Last updated on 14 Feb 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc