• Derive the deprecated fetcher.type from the current state of a fetcher and navigation.

    Parameters

    • fetcher: Pick<FetcherWithComponents<unknown>, "formMethod" | "data" | "state">

      The fetcher object returned form useFetcher

    • navigation: Pick<Navigation, "formMethod" | "state">

      The Navigation object returned from useNavigation

    Returns FetcherType

    let fetcher = useFetcher();
    let navigation = useNavigation();
    let fetcherType = getFetcherType(fetcher, navigation);
    useEffect(() => {
    if (fetcherType === "done") // do something once fetcher is done
    }, [fetcherType])