Skip to content

Commit

Permalink
feat(react): Deprecate react hook makers (#63)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoseLion committed Dec 23, 2022
1 parent 5b8402a commit 7410f53
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/lib/react/hookMakers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ type GotToHook = <S extends Routeway>(route: S, options?: NavigateOptions) =>
*
* @param getNavigate a function or hook that provideds a navigation function
* @returns a hook top create callback-like "goTo" functions of a route
*
* @deprecated in favour of {@link https://www.npmjs.com/package/react-routeways react-routeways} package
*/
export function makeGotToHook(getNavigate: () => NavigateFn): GotToHook {
return (route, options) => {
Expand All @@ -121,6 +123,8 @@ export function makeGotToHook(getNavigate: () => NavigateFn): GotToHook {
* @param routes the custom `Routeways` routes
* @param getNavigate a function or hook that provideds a navigation function
* @returns a navigation hook of the custom `Routeways` routes
*
* @deprecated in favour of {@link https://www.npmjs.com/package/react-routeways react-routeways} package
*/
export function makeNavigatorHook<T extends Record<string, Routeway>>(
routes: T,
Expand Down Expand Up @@ -166,6 +170,8 @@ export function makeNavigatorHook<T extends Record<string, Routeway>>(
*
* @param getLocation a function or hook that provides a location-like object
* @returns a hook to consume the path variables of a route
*
* @deprecated in favour of {@link https://www.npmjs.com/package/react-routeways react-routeways} package
*/
export function makePathVarsHook(getLocation: () => LocationLike): PathVarsHook {
return route => {
Expand All @@ -188,6 +194,8 @@ export function makePathVarsHook(getLocation: () => LocationLike): PathVarsHook
* @param getLocation a function or hook that provides a location-like object
* @param getNavigate a function or hook that provideds a navigation function
* @returns a hook to manage a query parameter of a route
*
* @deprecated in favour of {@link https://www.npmjs.com/package/react-routeways react-routeways} package
*/
export function makeQueryParamHook(getLocation: () => LocationLike, getNavigate: () => NavigateFn): QueryParamHook {
return ((route, key, fallback) => {
Expand Down Expand Up @@ -224,6 +232,8 @@ export function makeQueryParamHook(getLocation: () => LocationLike, getNavigate:
* @param getLocation a function or hook that provides a location-like object
* @param getNavigate a function or hook that provideds a navigation function
* @returns a hook to manage all query parameters of a route
*
* @deprecated in favour of {@link https://www.npmjs.com/package/react-routeways react-routeways} package
*/
export function makeAllQueryParamsHook(
getLocation: () => LocationLike,
Expand Down Expand Up @@ -264,6 +274,8 @@ export function makeAllQueryParamsHook(
* @param getLocation a function or hook that provides a location-like object
* @param getNavigate a function or hook that provideds a navigation function
* @returns a hook to manage all path variables and query parameters of a route
*
* @deprecated in favour of {@link https://www.npmjs.com/package/react-routeways react-routeways} package
*/
export function makeRouteParamsHook(getLocation: () => LocationLike, getNavigate: () => NavigateFn): RouteParamsHook {
return route => {
Expand Down

0 comments on commit 7410f53

Please sign in to comment.