mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
@reach/router: fix Location props
This commit is contained in:
parent
ed64b074de
commit
03eb09d3c3
6
types/reach__router/index.d.ts
vendored
6
types/reach__router/index.d.ts
vendored
@ -92,7 +92,11 @@ export interface NavigateOptions<TState> {
|
||||
replace?: boolean;
|
||||
}
|
||||
|
||||
export class Location extends React.Component<LocationContext> {}
|
||||
export interface LocationProps {
|
||||
children: LocationProviderRenderFn;
|
||||
}
|
||||
|
||||
export class Location extends React.Component<LocationProps> {}
|
||||
|
||||
export interface LocationProviderProps {
|
||||
history: History;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
import { Link, RouteComponentProps, Router } from "@reach/router";
|
||||
import { Link, Location, RouteComponentProps, Router } from "@reach/router";
|
||||
import * as React from "react";
|
||||
import { render } from "react-dom";
|
||||
|
||||
@ -21,6 +21,17 @@ render(
|
||||
<NotFound default />
|
||||
|
||||
<Link to="/somepath" rel="noopener noreferrer" target="_blank" />
|
||||
|
||||
<Location>
|
||||
{(context) => (
|
||||
<>
|
||||
<div>hostname is {context.location.hostname}</div>
|
||||
<button onClick={() => context.navigate("/")}>
|
||||
Go Home
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</Location>
|
||||
</Router>,
|
||||
document.getElementById("app-root"),
|
||||
);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user