DefinitelyTyped/types/react-router/test
Youen 2707abc38a [react-router] added possibility to specify component props in route definitions, and to specify the type of this.props.route.props when implementing such a component (#22954)
* [react-router] fixed lint error due to implicit any in CustomLink test

* [react-router] added possibility to specify component props in route definitions, and to specify the type of this.props.route.props when implementing such a component

Example:

/* component definition */
interface Props { foo: string }
class MyComponent extends React.Component<RouteComponentProps<void,void,Props>, State> {
    /* here you can use this.props.route.props.foo */
}

/* route configuration */
<Route path="/my-path" component={MyComponent} props={{ foo: 'bar' }}>

* - fixed lint errors related to T[] instead of Array<T>
- added default type for ComponentProps in RouteComponentProps<P,R,ComponentProps>, so that it stays compatible with existing code

* [react-router] added default route props type (any) so that this new feature is fully backward compatible

* [react-router] fixed lint errors (T[] instead of Array<T> for non-generic types)
2018-01-24 08:16:00 -08:00
..
examples-from-react-router-website
Children.tsx
InheritingRoute.tsx
MemoryRouter.tsx
NavigateWithContext.tsx
Switch.tsx
WithRouter.tsx