Skip to content

Commit 9fa54d6

Browse files
authored
docs: Updated TSDoc docs links (#8913)
* Fixed TSDoc docs link for react-router components * Fixed TSDoc docs link for react-router hooks * Add missing TSDoc docs link for react-router-dom * Fixed some TSDoc Docs links on react-router * Signed CLA
1 parent bd95e76 commit 9fa54d6

File tree

5 files changed

+38
-21
lines changed

5 files changed

+38
-21
lines changed

contributors.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,4 @@
6464
- vijaypushkin
6565
- vikingviolinist
6666
- xcsnowcity
67+
- marc2332

packages/react-router-dom/index.tsx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,8 @@ export interface BrowserRouterProps {
142142

143143
/**
144144
* A `<Router>` for use in web browsers. Provides the cleanest URLs.
145+
*
146+
* @see https://reactrouter.com/docs/en/v6/routers/browser-router
145147
*/
146148
export function BrowserRouter({
147149
basename,
@@ -181,6 +183,8 @@ export interface HashRouterProps {
181183
/**
182184
* A `<Router>` for use in web browsers. Stores the location in the hash
183185
* portion of the URL so it is not sent to the server.
186+
*
187+
* @see https://reactrouter.com/docs/en/v6/routers/hash-router
184188
*/
185189
export function HashRouter({ basename, children, window }: HashRouterProps) {
186190
let historyRef = React.useRef<HashHistory>();
@@ -218,6 +222,8 @@ export interface HistoryRouterProps {
218222
* to note that using your own history object is highly discouraged and may add
219223
* two versions of the history library to your bundles unless you use the same
220224
* version of the history library that React Router uses internally.
225+
*
226+
* @see https://reactrouter.com/docs/en/v6/routers/history-router
221227
*/
222228
function HistoryRouter({ basename, children, history }: HistoryRouterProps) {
223229
const [state, setState] = React.useState({
@@ -258,6 +264,8 @@ export interface LinkProps
258264

259265
/**
260266
* The public API for rendering a history-aware <a>.
267+
*
268+
* @see https://reactrouter.com/docs/en/v6/components/link
261269
*/
262270
export const Link = React.forwardRef<HTMLAnchorElement, LinkProps>(
263271
function LinkWithRef(
@@ -307,6 +315,8 @@ export interface NavLinkProps
307315

308316
/**
309317
* A <Link> wrapper that knows if it's "active" or not.
318+
*
319+
* @see https://reactrouter.com/docs/en/v6/components/nav-link
310320
*/
311321
export const NavLink = React.forwardRef<HTMLAnchorElement, NavLinkProps>(
312322
function NavLinkWithRef(
@@ -384,6 +394,8 @@ if (__DEV__) {
384394
* Handles the click behavior for router `<Link>` components. This is useful if
385395
* you need to create custom `<Link>` components with the same click behavior we
386396
* use in our exported `<Link>`.
397+
*
398+
* @see https://reactrouter.com/docs/en/v6/hooks/use-link-click-handler
387399
*/
388400
export function useLinkClickHandler<E extends Element = HTMLAnchorElement>(
389401
to: To,
@@ -425,6 +437,8 @@ export function useLinkClickHandler<E extends Element = HTMLAnchorElement>(
425437
/**
426438
* A convenient wrapper for reading and writing search parameters via the
427439
* URLSearchParams interface.
440+
*
441+
* @see https://reactrouter.com/docs/en/v6/hooks/use-search-params
428442
*/
429443
export function useSearchParams(defaultInit?: URLSearchParamsInit) {
430444
warning(
@@ -498,6 +512,8 @@ export type URLSearchParamsInit =
498512
* let searchParams = createSearchParams({
499513
* sort: ['name', 'price']
500514
* });
515+
*
516+
* @see https://reactrouter.com/docs/en/v6/utils/create-search-params
501517
*/
502518
export function createSearchParams(
503519
init: URLSearchParamsInit = ""

packages/react-router/lib/components.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export interface MemoryRouterProps {
2727
/**
2828
* A <Router> that stores all entries in memory.
2929
*
30-
* @see https://reactrouter.com/docs/en/v6/api#memoryrouter
30+
* @see https://reactrouter.com/docs/en/v6/routers/memory-router
3131
*/
3232
export function MemoryRouter({
3333
basename,
@@ -72,7 +72,7 @@ export interface NavigateProps {
7272
* able to use hooks. In functional components, we recommend you use the
7373
* `useNavigate` hook instead.
7474
*
75-
* @see https://reactrouter.com/docs/en/v6/api#navigate
75+
* @see https://reactrouter.com/docs/en/v6/components/navigate
7676
*/
7777
export function Navigate({ to, replace, state }: NavigateProps): null {
7878
invariant(
@@ -104,7 +104,7 @@ export interface OutletProps {
104104
/**
105105
* Renders the child route's element, if there is one.
106106
*
107-
* @see https://reactrouter.com/docs/en/v6/api#outlet
107+
* @see https://reactrouter.com/docs/en/v6/components/outlet
108108
*/
109109
export function Outlet(props: OutletProps): React.ReactElement | null {
110110
return useOutlet(props.context);
@@ -139,7 +139,7 @@ export interface IndexRouteProps {
139139
/**
140140
* Declares an element that should be rendered at a certain URL path.
141141
*
142-
* @see https://reactrouter.com/docs/en/v6/api#route
142+
* @see https://reactrouter.com/docs/en/v6/components/route
143143
*/
144144
export function Route(
145145
_props: PathRouteProps | LayoutRouteProps | IndexRouteProps
@@ -167,7 +167,7 @@ export interface RouterProps {
167167
* router that is more specific to your environment such as a <BrowserRouter>
168168
* in web browsers or a <StaticRouter> for server rendering.
169169
*
170-
* @see https://reactrouter.com/docs/en/v6/api#router
170+
* @see https://reactrouter.com/docs/en/v6/routers/router
171171
*/
172172
export function Router({
173173
basename: basenameProp = "/",
@@ -247,7 +247,7 @@ export interface RoutesProps {
247247
* A container for a nested tree of <Route> elements that renders the branch
248248
* that best matches the current location.
249249
*
250-
* @see https://reactrouter.com/docs/en/v6/api#routes
250+
* @see https://reactrouter.com/docs/en/v6/components/routes
251251
*/
252252
export function Routes({
253253
children,
@@ -265,7 +265,7 @@ export function Routes({
265265
* either a `<Route>` element or an array of them. Used internally by
266266
* `<Routes>` to create a route config from its children.
267267
*
268-
* @see https://reactrouter.com/docs/en/v6/api#createroutesfromchildren
268+
* @see https://reactrouter.com/docs/en/v6/utils/create-routes-from-children
269269
*/
270270
export function createRoutesFromChildren(
271271
children: React.ReactNode

packages/react-router/lib/hooks.tsx

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
* Returns the full href for the given "to" value. This is useful for building
2727
* custom links that are also accessible and preserve right-click behavior.
2828
*
29-
* @see https://reactrouter.com/docs/en/v6/api#usehref
29+
* @see https://reactrouter.com/docs/en/v6/hooks/use-href
3030
*/
3131
export function useHref(to: To): string {
3232
invariant(
@@ -55,7 +55,7 @@ export function useHref(to: To): string {
5555
/**
5656
* Returns true if this component is a descendant of a <Router>.
5757
*
58-
* @see https://reactrouter.com/docs/en/v6/api#useinroutercontext
58+
* @see https://reactrouter.com/docs/en/v6/hooks/use-in-router-context
5959
*/
6060
export function useInRouterContext(): boolean {
6161
return React.useContext(LocationContext) != null;
@@ -69,7 +69,7 @@ export function useInRouterContext(): boolean {
6969
* "routing" in your app, and we'd like to know what your use case is. We may
7070
* be able to provide something higher-level to better suit your needs.
7171
*
72-
* @see https://reactrouter.com/docs/en/v6/api#uselocation
72+
* @see https://reactrouter.com/docs/en/v6/hooks/use-location
7373
*/
7474
export function useLocation(): Location {
7575
invariant(
@@ -86,7 +86,7 @@ export function useLocation(): Location {
8686
* Returns the current navigation action which describes how the router came to
8787
* the current location, either by a pop, push, or replace on the history stack.
8888
*
89-
* @see https://reactrouter.com/docs/en/v6/api#usenavigationtype
89+
* @see https://reactrouter.com/docs/en/v6/hooks/use-navigation-type
9090
*/
9191
export function useNavigationType(): NavigationType {
9292
return React.useContext(LocationContext).navigationType;
@@ -97,7 +97,7 @@ export function useNavigationType(): NavigationType {
9797
* This is useful for components that need to know "active" state, e.g.
9898
* <NavLink>.
9999
*
100-
* @see https://reactrouter.com/docs/en/v6/api#usematch
100+
* @see https://reactrouter.com/docs/en/v6/hooks/use-match
101101
*/
102102
export function useMatch<
103103
ParamKey extends ParamParseKey<Path>,
@@ -134,7 +134,7 @@ export interface NavigateOptions {
134134
* Returns an imperative method for changing the location. Used by <Link>s, but
135135
* may also be used by other elements to change the location.
136136
*
137-
* @see https://reactrouter.com/docs/en/v6/api#usenavigate
137+
* @see https://reactrouter.com/docs/en/v6/hooks/use-navigate
138138
*/
139139
export function useNavigate(): NavigateFunction {
140140
invariant(
@@ -198,7 +198,7 @@ const OutletContext = React.createContext<unknown>(null);
198198
/**
199199
* Returns the context (if provided) for the child route at this level of the route
200200
* hierarchy.
201-
* @see https://reactrouter.com/docs/en/v6/api#useoutletcontext
201+
* @see https://reactrouter.com/docs/en/v6/hooks/use-outlet-context
202202
*/
203203
export function useOutletContext<Context = unknown>(): Context {
204204
return React.useContext(OutletContext) as Context;
@@ -208,7 +208,7 @@ export function useOutletContext<Context = unknown>(): Context {
208208
* Returns the element for the child route at this level of the route
209209
* hierarchy. Used internally by <Outlet> to render child routes.
210210
*
211-
* @see https://reactrouter.com/docs/en/v6/api#useoutlet
211+
* @see https://reactrouter.com/docs/en/v6/hooks/use-outlet
212212
*/
213213
export function useOutlet(context?: unknown): React.ReactElement | null {
214214
let outlet = React.useContext(RouteContext).outlet;
@@ -224,7 +224,7 @@ export function useOutlet(context?: unknown): React.ReactElement | null {
224224
* Returns an object of key/value pairs of the dynamic params from the current
225225
* URL that were matched by the route path.
226226
*
227-
* @see https://reactrouter.com/docs/en/v6/api#useparams
227+
* @see https://reactrouter.com/docs/en/v6/hooks/use-params
228228
*/
229229
export function useParams<
230230
ParamsOrKey extends string | Record<string, string | undefined> = string
@@ -261,7 +261,7 @@ export function useResolvedPath(to: To): Path {
261261
* elements in the tree must render an <Outlet> to render their child route's
262262
* element.
263263
*
264-
* @see https://reactrouter.com/docs/en/v6/api#useroutes
264+
* @see https://reactrouter.com/docs/en/v6/hooks/use-routes
265265
*/
266266
export function useRoutes(
267267
routes: RouteObject[],

packages/react-router/lib/router.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export interface RouteObject {
9898
/**
9999
* Returns a path with params interpolated.
100100
*
101-
* @see https://reactrouter.com/docs/en/v6/api#generatepath
101+
* @see https://reactrouter.com/docs/en/v6/utils/generate-path
102102
*/
103103
export function generatePath(path: string, params: Params = {}): string {
104104
return path
@@ -136,7 +136,7 @@ export interface RouteMatch<ParamKey extends string = string> {
136136
/**
137137
* Matches the given routes to a location and returns the match data.
138138
*
139-
* @see https://reactrouter.com/docs/en/v6/api#matchroutes
139+
* @see https://reactrouter.com/docs/en/v6/utils/match-routes
140140
*/
141141
export function matchRoutes(
142142
routes: RouteObject[],
@@ -383,7 +383,7 @@ type Mutable<T> = {
383383
* Performs pattern matching on a URL pathname and returns information about
384384
* the match.
385385
*
386-
* @see https://reactrouter.com/docs/en/v6/api#matchpath
386+
* @see https://reactrouter.com/docs/en/v6/utils/match-path
387387
*/
388388
export function matchPath<
389389
ParamKey extends ParamParseKey<Path>,
@@ -502,7 +502,7 @@ function safelyDecodeURIComponent(value: string, paramName: string) {
502502
/**
503503
* Returns a resolved path object relative to the given pathname.
504504
*
505-
* @see https://reactrouter.com/docs/en/v6/api#resolvepath
505+
* @see https://reactrouter.com/docs/en/v6/utils/resolve-path
506506
*/
507507
export function resolvePath(to: To, fromPathname = "/"): Path {
508508
let {

0 commit comments

Comments
 (0)