mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-06-28 14:20:12 +00:00
Merge pull request #16839 from DanielRosenwasser/routerUnionDuh
Allow 'children' to be an element in react-router.
This commit is contained in:
2
types/react-router/index.d.ts
vendored
2
types/react-router/index.d.ts
vendored
@@ -65,7 +65,7 @@ export interface RouteProps {
|
||||
location?: H.Location;
|
||||
component?: React.SFC<RouteComponentProps<any> | undefined> | React.ComponentClass<RouteComponentProps<any> | undefined>;
|
||||
render?: ((props: RouteComponentProps<any>) => React.ReactNode);
|
||||
children?: ((props: RouteComponentProps<any>) => React.ReactNode | React.ReactNode);
|
||||
children?: ((props: RouteComponentProps<any>) => React.ReactNode) | React.ReactNode;
|
||||
path?: string;
|
||||
exact?: boolean;
|
||||
strict?: boolean;
|
||||
|
||||
22
types/react-router/test/Children.tsx
Normal file
22
types/react-router/test/Children.tsx
Normal file
@@ -0,0 +1,22 @@
|
||||
import * as React from 'react';
|
||||
import { Route } from 'react-router';
|
||||
|
||||
function RouteWithFunctionChildrenAttribute() {
|
||||
return <Route path="/" children={() => <div>Hello!</div>} />;
|
||||
}
|
||||
|
||||
function RouteWithFunctionJsxChildren() {
|
||||
return <Route path="/">
|
||||
{() => <div>Hello!</div>}
|
||||
</Route>;
|
||||
}
|
||||
|
||||
function RouteWithElementChildrenAttribute() {
|
||||
return <Route path="/" children={<div>Hello!</div>} />;
|
||||
}
|
||||
|
||||
function RouteWithElementJsxChildren() {
|
||||
return <Route path="/">
|
||||
{<div>Hello!</div>}
|
||||
</Route>;
|
||||
}
|
||||
@@ -18,6 +18,7 @@
|
||||
"test/Animation.tsx",
|
||||
"test/Auth.tsx",
|
||||
"test/Basic.tsx",
|
||||
"test/Children.tsx",
|
||||
"test/CustomLink.tsx",
|
||||
"test/ModalGallery.tsx",
|
||||
"test/NavigateWithContext.tsx",
|
||||
|
||||
Reference in New Issue
Block a user