Last active
June 27, 2019 20:59
-
-
Save chpio/a5d4f7d73d6643780db20db163561a67 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import {Route, Link as RouterLink, withRouter} from 'react-router-dom'; | |
function Link({to, location, children, staticContext, match, history, ...rest}) { | |
/* eslint-disable react/jsx-no-bind */ | |
return ( | |
<Route | |
render={() => | |
<RouterLink | |
replace={to === location.pathname} | |
to={to} | |
{...rest} | |
> | |
{children} | |
</RouterLink> | |
} | |
/> | |
); | |
} | |
export default withRouter(Link); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment