mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 15:27:05 +00:00
Merge pull request #32119 from chitoku-k/fix/reach__router
[@reach/router] Change LocationProviderProps#history to be optional
This commit is contained in:
Vendored
+1
-1
@@ -110,7 +110,7 @@ export interface LocationProps {
|
||||
export class Location extends React.Component<LocationProps> { }
|
||||
|
||||
export interface LocationProviderProps {
|
||||
history: History;
|
||||
history?: History;
|
||||
children?: React.ReactNode | LocationProviderRenderFn;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {
|
||||
Link,
|
||||
Location,
|
||||
LocationProvider,
|
||||
RouteComponentProps,
|
||||
Router,
|
||||
Redirect
|
||||
@@ -45,6 +46,16 @@ render(
|
||||
</>
|
||||
)}
|
||||
</Location>
|
||||
<LocationProvider>
|
||||
{context => (
|
||||
<>
|
||||
<div>hostname is {context.location.hostname}</div>
|
||||
<button onClick={() => context.navigate('/')}>
|
||||
Go Home
|
||||
</button>
|
||||
</>
|
||||
)}
|
||||
</LocationProvider>
|
||||
</Router>,
|
||||
document.getElementById('app-root')
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user