Skip to content
This repository has been archived by the owner on Jun 15, 2020. It is now read-only.

Latest commit

 

History

History
20 lines (13 loc) · 848 Bytes

pushUrlQuery.md

File metadata and controls

20 lines (13 loc) · 848 Bytes

pushUrlQuery(newQuery, [location])

Updates the URL to have newQuery as the new set of query parameters, completely replacing what was there previously. Uses push to change the URL, which means the new state will be pushed on to the history stack, so the back button will be able to return you to the previous state.

Arguments

  1. newQuery (Object): An object mapping query parameter names to values (String).
  2. [location] (Object): The location from which the current URL state should be read. If not provided, location is read from the configured history or the window.

Returns

(Any): The result of history.push(), will depend on the history being used.

Examples

// Given URL /page?foo=bar&baz=123&jim=bo
pushUrlQuery({ foo: 'test', jim: 'vlan' });
// URL is now /page?foo=test&jim=vlan