hrefHandler
Turns all <a href> elements into SPA links with a navigate callback.
Installation
npm install react-beyond @react-beyond/hrefhandler
Usage
import { Beyond } from 'react-beyond'
import { classFor } from '@react-beyond/hrefhandler'
<Beyond features={[hrefHandler({
navigate: (href) => {
alert(`Navigating to ${href} with React Beyond`)
}
})]}>
<App />
</Beyond>
Options
id
- The id of the feature HOC. Defaults to"hrefHandler"
.navigate: (href: string) => void
- This function will be called when the user clicks on a link.onlyRelative?: boolean
- If true, it will only handle relative links. Defaults totrue
.