| useFetcher | R Documentation |
https://api.reactrouter.com/v7/functions/react-router.useFetcher.html
useFetcher(
into = NULL,
as = "children",
selector = "state",
render = NULL,
fetcherKey = NULL,
...
)
into |
A component (HTML tag or shiny.react-based element) that will receive the hook data as the specified prop. |
as |
Character. The name of the component's prop to inject the hook
data into (by default |
selector |
Character. Optional key to extract from the hook data object.
If |
render |
Optional |
fetcherKey |
Character. Optional key to share a fetcher across
components (e.g. |
... |
Additional props to pass to the component. |
Calls the useFetcher() hook and injects the result (or a
selector from it) as a prop of the into component.
Use to fetch data or submit forms without causing a navigation.
The fetcher object has state ("idle"/"loading"/"submitting") and
data (the response from a loader or action).
selector defaults to "state" so the default into/
children display shows a readable string ("idle" /
"loading" / "submitting"). The full fetcher object contains
methods (submit, load, Form) that would be silently
dropped by JSON serialization if the whole object were rendered as
children. To call those methods, use the render = JS(...) form,
which receives the full fetcher: render = JS("f => <button onClick={() => f.load('/data')}>Reload</button>").
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.