on-location-changed
v1.0.23
Published
My new module
Maintainers
Readme
Installation
This package intentionally does not expose a root entrypoint. Import the
specific helper you need from on-location-changed/build/* so bundlers do not
pull unrelated React, Expo Router, browser-history, or query-param helpers into
the consumer bundle.
import {callbacksHandler} from "on-location-changed/build/callbacks-handler"
callbacksHandler.connectReactRouterHistory(history)Usage
import WithCustomPath from "on-location-changed/build/with-custom-path"<WithCustomPath path={somePath}>
<App />
</WithCustomPath><WithLocationPath>
<App />
</WithLocationPath>import WithExpoLocationPath from "on-location-changed/build/with-expo-location-path"<WithExpoLocationPath>
<App />
</WithExpoLocationPath>import usePath from "on-location-changed/build/use-path"const path = usePath()import useSelectedQueryParams from "on-location-changed/build/use-selected-query-params"const params = useSelectedQueryParams(["project_ids", {q: ["name_cont", "state_in"]}])import useLocationPath from "on-location-changed/build/use-location-path"const path = useLocationPath()import currentLocationPath from "on-location-changed/build/current-location-path"
import currentQueryParams from "on-location-changed/build/current-query-params"
import useCurrentQueryParams from "on-location-changed/build/use-current-query-params"const path = currentLocationPath()
const params = currentQueryParams()
const readCurrentQueryParams = useCurrentQueryParams()import onSelectedQueryParamsChanged from "on-location-changed/build/on-selected-query-params-changed"const subscription = onSelectedQueryParamsChanged("project_ids", (params) => {
console.log(params)
})
subscription.disconnect()import {locationPathWithQueryParams, pushQueryParamUpdates} from "on-location-changed/build/query-param-updates"const path = locationPathWithQueryParams("/timelogs", {project_ids: ["1", "2"]})
pushQueryParamUpdates(router, readCurrentQueryParams(), "/timelogs", {
project_ids: ["3"]
})