diff --git a/src/components/Link/index.js b/src/components/Link/index.js index 7562287..100f57d 100644 --- a/src/components/Link/index.js +++ b/src/components/Link/index.js @@ -102,6 +102,14 @@ class Link extends React.PureComponent { return !!match; }; + shouldComponentUpdate(nextProps) { + const props = {...nextProps}; + if (!props.children || !props.children.length) { + delete props.children; + } + return !deepEqual(this.props, nextProps); + } + render() { const { history, @@ -148,10 +156,17 @@ class LinkWithMiddleware extends React.PureComponent { props => ); + shouldComponentUpdate(nextProps) { + const props = {...nextProps}; + if (!props.children || !props.children.length) { + delete props.children; + } + return !deepEqual(this.props, nextProps); + } + render() { return this.renderWithMiddleware(this.props); } } export default withRouter(LinkWithMiddleware); -