Fix type to use correct NavLinkProps

This commit is contained in:
LKay 2017-05-24 14:54:37 +09:00
parent e63f331400
commit 36eb56cdf2
No known key found for this signature in database
GPG Key ID: 9B137873E6A8A144
3 changed files with 6 additions and 5 deletions

View File

@ -1,9 +1,9 @@
import { ComponentClass } from "react";
import { LinkProps } from "react-router-dom";
import { NavLinkProps } from "react-router-dom";
//IndexLink is removed in react-router, but continues there in react-router-bootstrap for backwards compatibility.
//IndexLink is removed in react-router, but continues there in react-router-bootstrap for backwards compatibility.
//Better use <LinkContainer exact/>
type IndexLinkContainer = ComponentClass<LinkProps>;
type IndexLinkContainer = ComponentClass<NavLinkProps>;
declare const IndexLinkContainer: IndexLinkContainer;
export default IndexLinkContainer;

View File

@ -1,7 +1,7 @@
import { ComponentClass } from "react";
import { LinkProps } from "react-router-dom";
import { NavLinkProps } from "react-router-dom";
type LinkContainer = ComponentClass<LinkProps>;
type LinkContainer = ComponentClass<NavLinkProps>;
declare const LinkContainer: LinkContainer;
export default LinkContainer;

View File

@ -15,6 +15,7 @@ export class ReactRouterBootstrapTest extends Component<any, any> {
<div style={style}>
<LinkContainer to="/page"><Button>Link</Button></LinkContainer>
<LinkContainer to="/page" exact strict><Button>Link</Button></LinkContainer>
<IndexLinkContainer to="/index"><Button>Link</Button></IndexLinkContainer>
</div>
</div>