Merge pull request #32119 from chitoku-k/fix/reach__router

[@reach/router] Change LocationProviderProps#history to be optional
This commit is contained in:
Daniel Rosenwasser
2019-01-18 17:05:56 -08:00
committed by GitHub
2 changed files with 12 additions and 1 deletions
+1 -1
View File
@@ -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')
);