| useLinkClickHandler | R Documentation |
https://api.reactrouter.com/v7/functions/react-router.useLinkClickHandler.html
useLinkClickHandler(
into = NULL,
as = "children",
render = NULL,
to,
replace = NULL,
state = NULL,
target = NULL,
preventScrollReset = NULL,
relative = NULL,
...
)
into |
A component (HTML tag or shiny.react-based element) that will receive the hook value as the specified prop. |
as |
Character. The name of the component's prop to inject the hook
value into. Defaults to |
render |
Optional |
to |
Character. Destination path. |
replace |
Optional boolean. Replace the current entry in the history stack instead of pushing a new one. |
state |
Optional. State value to attach to the new location. |
target |
Optional character. Anchor target (e.g. |
preventScrollReset |
Optional boolean. If |
relative |
Optional character. Either |
... |
Additional props to pass to the component. |
Calls the useLinkClickHandler() hook and exposes the returned click
handler function via render (or injects it as a prop of
into, e.g. as = "onClick"). Lets you build link-like
components that drive client-side navigation without using
Link.
Because the hook returns a function, the render form is the natural
fit:
useLinkClickHandler(
to = "/about",
render = JS("h => <span onClick={h} role='link'>About</span>")
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.