Skip to content

Commit 5783476

Browse files
committed
pass through attributes to link
1 parent 8cd5349 commit 5783476

File tree

3 files changed

+12
-6
lines changed

3 files changed

+12
-6
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"tsc": "tsc"
2323
},
2424
"devDependencies": {
25-
"typescript": "next"
25+
"typescript": "^2.1.4"
2626
},
2727
"dependencies": {
2828
"react": "15.x.x",

src/link.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,11 @@ export default class Link extends React.Component<Props, State> {
1919
e.preventDefault();
2020
};
2121
render() {
22-
return <a href={this.props.to} onClick={this.navigate} className={this.props.className}>{this.props.children}</a>;
22+
const {
23+
to,
24+
...rest
25+
} = this.props;
26+
27+
return <a href={to} onClick={this.navigate} {...rest}>{this.props.children}</a>;
2328
}
2429
}

yarn.lock

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
22
# yarn lockfile v1
3+
4+
35
asap@~2.0.3:
46
version "2.0.5"
57
resolved "https://registry.yarnpkg.com/asap/-/asap-2.0.5.tgz#522765b50c3510490e52d7dcfe085ef9ba96958f"
@@ -96,9 +98,9 @@ router-async:
9698
dependencies:
9799
path-to-regexp "^1.6.0"
98100

99-
typescript@next:
100-
version "2.1.0-dev.20161027"
101-
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.1.0-dev.20161027.tgz#f6456102956dee194398fa1ad093b944c8db4f0a"
101+
typescript@^2.1.4:
102+
version "2.1.4"
103+
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.1.4.tgz#b53b69fb841126acb1dd4b397d21daba87572251"
102104

103105
ua-parser-js@^0.7.9:
104106
version "0.7.10"
@@ -107,4 +109,3 @@ ua-parser-js@^0.7.9:
107109
whatwg-fetch@>=0.10.0:
108110
version "1.0.0"
109111
resolved "https://registry.yarnpkg.com/whatwg-fetch/-/whatwg-fetch-1.0.0.tgz#01c2ac4df40e236aaa18480e3be74bd5c8eb798e"
110-

0 commit comments

Comments
 (0)