pushInUrlQueryFromAction(action, [location])

A helper function for when you want to use redux dispatch to handle your URL updating actions, an optional way of combining Redux with React URL Query. It expects the action to have the form:

  payload: {
    queryParam: String,
    encodedValue: String,

This function is typically only useful when using your own urlReducer, as shown in this example.

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.


  1. action (Object): An action, typically from urlPushInAction. Shape described above.
  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.


(void): It does not return anything.


// create an action creator
const changeFoo = urlPushInAction('CHANGE_FOO', 'foo', UrlQueryParamTypes.number);

// call an action creator to get an action
const action = changeFoo(94);

// typically in a reducer, call this helper to update the URL
// e.g. URL was /page?foo=123&bar=baz
// e.g. URL now is /page?foo=94&bar=baz

results matching ""

    No results matching ""