API Reference
Top-Level Exports
React URL Query provides a number of top-level exports.
Type Enums
Serialization
- Serialize
- decode(type, encodedValue, [defaultValue]), alias of Serialize.decode for convenience
- encode(type, valueToEncode), alias of Serialize.encode for convenience
Utils
URL Update
- replaceInUrlQuery(queryParam, encodedValue, [location])
- pushInUrlQuery(queryParam, encodedValue, [location])
- replaceUrlQuery(newQuery, [location])
- pushUrlQuery(newQuery, [location])
- multiReplaceInUrlQuery(queryReplacements, [location])
- multiPushInUrlQuery(queryReplacements, [location])
React-Router v4
Redux Action Integration
Note that these helpers are provided in the event you would like to use Redux's dispatch
to update the URL. They are not necessary for using React URL Query with Redux. Compare the example without using dispatch with the example using dispatch.
- replaceInUrlQueryFromAction(action, [location])
- replaceUrlQueryFromAction(action, [location])
- pushInUrlQueryFromAction(action, [location])
- pushUrlQueryFromAction(action, [location])
- urlAction(actionType, payload, [meta])
- urlReplaceInAction(actionType, queryParam, valueType)
- urlPushInAction(actionType, queryParam, valueType)
- urlReplaceAction(actionType, [encodeQuery])
- urlPushAction(actionType, [encodeQuery])
- urlQueryMiddleware([options])
- urlQueryReducer(action, [location])
Importing
You can import any of the Top-Level Exports as follows:
ES6
import { addUrlProps } from 'react-url-query'