1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Use less code to detect replace instead of push (#5969)

This commit is contained in:
Tim Neutkens 2018-12-31 19:05:49 +01:00 committed by GitHub
parent 36164ead80
commit b0cad3370d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -83,11 +83,7 @@ class Link extends Component {
}
// replace state instead of push if prop is present
const { replace } = this.props
const changeMethod = replace ? 'replace' : 'push'
// straight up redirect
Router[changeMethod](href, as, { shallow: this.props.shallow })
Router[this.props.replace ? 'replace' : 'push'](href, as, { shallow: this.props.shallow })
.then((success) => {
if (!success) return
if (scroll) {