• Type Parameters

    • Data

    Parameters

    • Optionalopts: { key?: string }
      • Optionalkey?: string

        By default, useFetcher generate a unique fetcher scoped to that component. If you want to identify a fetcher with your own key such that you can access it from elsewhere in your app, you can do that with the key option:

        function SomeComp() {
        let fetcher = useFetcher({ key: "my-key" })
        // ...
        }

        // Somewhere else
        function AnotherComp() {
        // this will be the same fetcher, sharing the state across the app
        let fetcher = useFetcher({ key: "my-key" });
        // ...
        }

    Returns DebouncedFetcher<Data>