diff options
Diffstat (limited to 'packages/gitbook-core/src/components/Link.js')
-rw-r--r-- | packages/gitbook-core/src/components/Link.js | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/packages/gitbook-core/src/components/Link.js b/packages/gitbook-core/src/components/Link.js index ab364bb..9827f0b 100644 --- a/packages/gitbook-core/src/components/Link.js +++ b/packages/gitbook-core/src/components/Link.js @@ -6,6 +6,12 @@ const SummaryArticle = require('../models/SummaryArticle'); const SummaryArticleShape = require('../propTypes/SummaryArticle'); const FileShape = require('../propTypes/File'); +/** + * Link to another page or file in the book. Using this component instead of <a> + * avoid broken links when location changes. + * + * @type {ReactClass} + */ const Link = React.createClass({ propTypes: { currentFile: FileShape, @@ -22,6 +28,7 @@ const Link = React.createClass({ render() { const { currentFile, to, children, ...props } = this.props; let href = to; + delete props.dispatch; if (SummaryArticle.is(to) || File.is(to)) { href = to.url; @@ -32,6 +39,6 @@ const Link = React.createClass({ } }); -module.exports = ReactRedux.connect(state => { +module.exports = ReactRedux.connect((state) => { return { currentFile: state.file }; })(Link); |