Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onMouseEnter={e => {
// eslint-disable-line
onMouseEnter && onMouseEnter(e)
___loader.hovering(parsePath(to).pathname)
}}
onClick={e => {
componentDidUpdate(prevProps, prevState) {
// Preserve non IO functionality if no support
if (this.props.to !== prevProps.to && !this.state.IOSupported) {
___loader.enqueue(parsePath(this.props.to).pathname)
}
}
// eslint-disable-line
onClick && onClick(e)
if (
e.button === 0 && // ignore right clicks
!this.props.target && // let browser handle "target=_blank"
!e.defaultPrevented && // onClick prevented default
!e.metaKey && // ignore clicks with modifier keys...
!e.altKey &&
!e.ctrlKey &&
!e.shiftKey
) {
e.preventDefault()
// Is this link pointing to a hash on the same page? If so,
// just scroll there.
const { pathname, hash } = parsePath(prefixedTo)
if (pathname === location.pathname || !pathname) {
const element = hash
? document.getElementById(hash.substr(1))
: null
if (element !== null) {
element.scrollIntoView()
} else {
// This is just a normal link to the current page so let's emulate default
// browser behavior by scrolling now to the top of the page.
window.scrollTo(0, 0)
}
}
// Make sure the necessary scripts and data are
// loaded before continuing.
navigate(to, { state, replace })
componentDidMount() {
// Preserve non IO functionality if no support
if (!this.state.IOSupported) {
___loader.enqueue(parsePath(this.props.to).pathname)
}
}
handleIntersection(ref, () => {
___loader.enqueue(parsePath(this.props.to).pathname)
})
}